Skip to content
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

allow specification of line color in MG.data_graphic #503

Closed
hamilton opened this issue Oct 6, 2015 · 2 comments
Closed

allow specification of line color in MG.data_graphic #503

hamilton opened this issue Oct 6, 2015 · 2 comments
Assignees
Milestone

Comments

@hamilton
Copy link
Collaborator

hamilton commented Oct 6, 2015

There are often cases where relying on CSS to determine line colors is not flexible enough. Being able to pass in an array of colors would be a useful option.

@hamilton hamilton self-assigned this Oct 6, 2015
@hamilton hamilton added this to the v2.7 milestone Oct 6, 2015
hamilton added a commit that referenced this issue Oct 8, 2015
…arily about moving away from using mg-line1-color as a selector. getting rid of the -color part of the class means that the selectors for rollovers are purely about selection, not color. This allows us to do things like color lines using a new argument: colors, which takes an array, and colors the lines as they are ordered by accessor or by placement in the data argument. This is primarily targeted toward #503, but required this refactoring and reworking so that nothing else breaks.
@hamilton
Copy link
Collaborator Author

hamilton commented Oct 8, 2015

@almossawi Would love to get another set of eyes on this commit.

The change is:

1.) we add new classes to line elements + rollovers so we are not selecting based on -color, but more generic classes.
2.) added new keyword argument(s) color and colors, which do the same thing. If you have a single line, you can specify a string that is a hex / rgb / web color, and if you have a multiline, you can specify an array of colors.

This required a pretty major refactoring of how we select elements in the rollovers for line charts, but I think it is worth it since it a. removes the conflation of color and rollover selections, class-wise, which makes the whole thing cleaner, and b. opens up coloring lines in the API itself, not just in CSS. I've pretty thoroughly tested it across voronoi, linked charts, single line charts, and aggregate rollovers, but have not against the custom_color_map logic, since I am less familiar with it. Added examples as well.

At any rate, take a look and see what you think. Trying to curtail my agent-of-chaos status on this lib, but couldn't resist this change.

almossawi added a commit that referenced this issue Oct 13, 2015
@almossawi
Copy link
Contributor

@hamilton Wonderful. It looks great 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants