This repository was archived by the owner on Dec 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Feature/legend filter #238
Open
romsson
wants to merge
36
commits into
beta
Choose a base branch
from
feature/legend-filter
base: beta
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
4270f0c
Using group attribute for filtering with VisTK
romsson 4c4f5b5
Adding active/inactive toggle and class binding
romsson e72d1b9
Notify upstream component it became active
romsson b85ca88
Toggling active key coming from downstream
romsson 8354a79
Mapping actions and active value to keys' parent component
romsson 5cb9eae
Keys actions binding and styling
romsson 6689445
CSS styling for keys for affordance and to reflect currently active key
romsson 730c158
WIP to test charts dynamic filtering
romsson 7561afc
Cleanup
romsson 0f2fc0a
Adding filter variable to the controller
romsson 05a35d4
Now using controller filter variable
romsson 54b9da0
Passing controller value to the components
romsson 60481f6
Observing filter variable and refreshing the scatterplot
romsson 399ce01
Support for interactive legend
romsson 562a9a6
Cleanup
romsson c889a25
Using group attribute for filtering with VisTK
romsson 5e67542
Adding active/inactive toggle and class binding
romsson 6867aa2
Notify upstream component it became active
romsson 87a0c29
Toggling active key coming from downstream
romsson 321afb6
Mapping actions and active value to keys' parent component
romsson b4e3f4c
Keys actions binding and styling
romsson 98e98db
CSS styling for keys for affordance and to reflect currently active key
romsson c4d7e99
WIP to test charts dynamic filtering
romsson 13b99d6
Cleanup
romsson 76145ae
Adding filter variable to the controller
romsson 05d2f5e
Now using controller filter variable
romsson 8c36ab3
Passing controller value to the components
romsson 5c5d7bc
Observing filter variable and refreshing the scatterplot
romsson f0c18db
Support for interactive legend
romsson 65fc896
Cleanup
romsson bd769d3
Merge branch 'feature/legend-filter' of github.com:cid-harvard/atlas-…
romsson aa2db94
Turning scatter config into variable so it can easily be re-used
romsson 2c50df3
Making sure keyFilter array exists
romsson 15b5446
Network config as a variable
romsson 53475be
Making sure filter don't color non-exported products
romsson 2469beb
Making exported products slightly more prominent
romsson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,12 +14,12 @@ export default Ember.Component.extend({ | |
| id: computed('elementId', function() { | ||
| return `#${this.get('elementId')}`; | ||
| }), | ||
| scatter: computed('data.@each', 'dataType','eciValue','i18n.locale', function() { | ||
| config: computed('data.@each', 'dataType','eciValue','i18n.locale', function() { | ||
| let eci = this.get('eciValue'); | ||
| let lang = this.get('i18n.locale') === 'en-col' ? 'en_EN': 'es_ES'; | ||
| let keyFilter = this.get('keyFilter') || []; | ||
| let format = function(value) { return numeral(value).format('0.00'); }; | ||
| return vistk.viz() | ||
| .params({ | ||
| return { | ||
| type: 'scatterplot', | ||
| margin: {top: 10, right: 20, bottom: 30, left: 30}, | ||
| height: this.get('height'), | ||
|
|
@@ -30,6 +30,7 @@ export default Ember.Component.extend({ | |
| var_x: 'distance', | ||
| var_y: 'complexity', | ||
| var_r: this.get('varSize'), | ||
| var_group: 'group', | ||
| radius_min: 2, | ||
| radius_max: 10, | ||
| x_domain: this.get('x_domain'), | ||
|
|
@@ -159,8 +160,12 @@ export default Ember.Component.extend({ | |
| } | ||
| }] | ||
| }], | ||
| filter: keyFilter, | ||
| lang: lang | ||
| }); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And another jshint complaint here about a missing semicolon |
||
| }), | ||
| scatter: computed('data.@each', 'dataType','eciValue','i18n.locale', function() { | ||
| return vistk.viz().params(this.get('config')); | ||
| }), | ||
| varSize: computed('dataType', function() { | ||
| if(this.get('dataType') === 'products') { return 'cog'; } | ||
|
|
@@ -194,6 +199,18 @@ export default Ember.Component.extend({ | |
| this.removeObserver('i18n.locale', this, this.update); | ||
| this.removeObserver('data.[]', this, this.update); | ||
| }, | ||
| refresh: observer('keyFilter', function() { | ||
| if(!this.element){ return ; } //do not redraw if not there | ||
| let keyFilter = this.get('keyFilter') || []; | ||
|
|
||
| Ember.run.later(this , function() { | ||
| if(this.get('scatter')) { | ||
| this.get('scatter').params({filter: keyFilter}); | ||
| this.get('scatter').params().refresh = true; | ||
| d3.select(this.get('id')).call(this.get('scatter')); | ||
| } | ||
| }); | ||
| }), | ||
| update: observer('data.@each', 'varRca', 'i18n.locale', 'dataType', function() { | ||
| if(!this.element){ return ; } //do not redraw if not there | ||
| d3.select(this.get('id')).select('svg').remove(); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,25 @@ | ||
| import Ember from 'ember'; | ||
| const { computed, get } = Ember; | ||
| const {computed, get} = Ember; | ||
|
|
||
| export default Ember.Component.extend({ | ||
| color: computed.alias('key.color'), | ||
| code: computed.alias('key.code'), | ||
| name: computed('key', 'i18n.locale', function(){ | ||
| let locale = get(this, 'i18n.display'); | ||
| return get(this, `key.name_${locale}`); | ||
| }), | ||
| myStyle: computed('color', function() { | ||
| var color = this.get('color'); | ||
| return new Ember.Handlebars.SafeString("color: " + color); | ||
| }) | ||
| }), | ||
| classNameBindings: ['isActive'], | ||
| active: false, | ||
| isActive: computed('active', function() { | ||
| return this.get('code') === this.get('active'); | ||
| }), | ||
| actions: { | ||
| changeKey() { | ||
| this.sendAction('action', this.get('code')); | ||
| } | ||
| } | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,19 @@ | ||
| import Ember from 'ember'; | ||
|
|
||
| export default Ember.Component.extend({ | ||
| activeKey: null, | ||
| actions: { | ||
| changeKey(key) { | ||
| let code = []; | ||
|
|
||
| if(this.get('activeKey') === key) { | ||
| this.set('activeKey', null); | ||
| } else { | ||
| this.set('activeKey', key); | ||
| code = [key]; | ||
| } | ||
|
|
||
| this.set('keyFilter', code); | ||
| } | ||
| } | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| <i class="fa fa-circle" style={{myStyle}}></i> {{name}} | ||
| <span {{action 'changeKey'}}><i class="fa fa-circle" style={{myStyle}}></i> {{name}}</span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| <div class="buildermod__legend"> | ||
| {{#each key in legend}} | ||
| <div class="buildermod__legend__item"> | ||
| {{visualization-legend-key key=key }} | ||
| {{visualization-legend-key key=key active=activeKey action='changeKey'}} | ||
| </div> | ||
| {{else}} | ||
| {{/each}} | ||
| </div> | ||
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JShint complaining about a missing semicolon here