-
Notifications
You must be signed in to change notification settings - Fork 1
Tweak color picker, angularize legend #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8895757
9f705d8
ee8d05f
28c8950
20b6d74
afa135f
c79b00c
a7e35d9
5f5aab8
9752d18
9d6273b
3220c54
5106399
3e45978
f548e96
a85cb1d
b16d5a3
45a315b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| define(function (require) { | ||
| var _ = require('lodash'); | ||
| var keys = {}; | ||
| return { | ||
| get: function (path, def) { | ||
| return keys[path] == null ? def : keys[path]; | ||
| }, | ||
| set: function (path, val) { | ||
| keys[path] = val; | ||
| return val; | ||
| }, | ||
| on: _.noop, | ||
| off: _.noop | ||
| } | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| define(function (require) { | ||
|
Collaborator
Author
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. Pulled this out of |
||
| var _ = require('lodash'); | ||
| // given an object or array of objects, return the value of the passed param | ||
| // if the param is missing, return undefined | ||
| return function findByParam(values, param) { | ||
| if (_.isArray(values)) { // point series chart | ||
| var index = _.findIndex(values, param); | ||
| if (index === -1) return; | ||
| return values[index][param]; | ||
| } | ||
| return values[param]; // pie chart | ||
| }; | ||
| }); | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -226,16 +226,8 @@ define(function (require) { | |
| */ | ||
| Dispatch.prototype.highlightLegend = function (element) { | ||
| var label = this.getAttribute('data-label'); | ||
|
|
||
| if (!label) return; | ||
|
|
||
| d3.select(element) | ||
| .select('.legend-ul') | ||
| .selectAll('li.color') | ||
| .filter(function (d, i) { | ||
| return String(d.label) !== label; | ||
| }) | ||
| .classed('blur_shape', true); | ||
| $('[data-label]', element.parentNode).not('[data-label="' + label + '"]').css('opacity', 0.5); | ||
| }; | ||
|
|
||
|
Collaborator
Author
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. Since the legend isn't part of the Vis object now, rather the visualize directive, we need to get at the parent to make this work. Css selectors and Jquery make this a bit more concise |
||
| /** | ||
|
|
@@ -245,10 +237,7 @@ define(function (require) { | |
| * @method unHighlightLegend | ||
| */ | ||
| Dispatch.prototype.unHighlightLegend = function (element) { | ||
| d3.select(element) | ||
| .select('.legend-ul') | ||
| .selectAll('li.color') | ||
| .classed('blur_shape', false); | ||
| $('[data-label]', element.parentNode).css('opacity', 1); | ||
| }; | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,10 +100,6 @@ define(function (require) { | |
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| type: 'div', | ||
| class: 'legend-col-wrapper' | ||
| } | ||
| ] | ||
| } | ||
|
|
||
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.
Added
simulateso you can check whether or not a filter would be created by this function. Allows us to check if we should display the filter buttons without reimplementing all of the logic in this file somewhere else.