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

Added caching for consistent color of values across visualization. Closes #485 #4429

Merged
merged 4 commits into from
Jul 22, 2015

Conversation

gauravsinghania
Copy link
Contributor

Mapping of values and color. So that a given value when repeated across visualization uses the same color for a dashboard. Closes #485.

@elasticsearch-release
Copy link

Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run; then say 'jenkins, test it'.


return function (value) {
return colorObj[value];
if (!mappedColors.get(value))
mappedColors.add(value, colorObj[value]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conditional statements over two lines should include brackets: {}.
For example:

if (!mappedColors.get(value)) {
  mappedColors.add(value, colorObj[value]);
}

@stormpython
Copy link
Contributor

@gauravsinghania
The changes to the color module seem to have a bad affect on the Discover bar chart.
screen shot 2015-07-14 at 1 59 39 pm

In addition, in the Visualize view, the initial color for (lines, bars, area in) charts does not match the color in the legend.
screen shot 2015-07-14 at 12 05 03 pm

On occasion, when I refresh the page, the colors for values change. The colors for each item remain consistent across charts in a dashboard, but the colors change for a value from say red to green. But this may be due to our current "state" issues with our visualization library. I am looking into this. I will also try and get a gif example of what I mean up here.

Perhaps the default color for charts with only count values should be: #57c17b. So, effectively this color cannot be saved as a value for any item.

return color(d.label);
var label = d.label ;
if (!label)
label = this.getAttribute('data-label');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conditional statements on more than one line should include brackets.

@gauravsinghania
Copy link
Contributor Author

@stormpython thanks for the input, I will fix the issue with the line chart and brackets. However, for the discover bar chart does a presence of color signify anything or is it okay to have black color? Also, is it only the color of the discover bar chart or some other bad effect?

@gauravsinghania
Copy link
Contributor Author

@stormpython colouring for line and area chart is taken care of.

@stormpython
Copy link
Contributor

@gauravsinghania thanks! I will continue to review. Its important that discover bars have a color, and I discussed it with others on the team, and we think the best solution is actually to add an option to set the color explicitly.

@gauravsinghania
Copy link
Contributor Author

@stormpython I looked at the issue of discover bars, I felt adding color explicitly might not be the best way. So, I have added label to the elements even for a single data set (earlier label was only added when we have mutliple data sets like in a split graph etc) and thus the color gets auto picked in all cases. Because of this change some of my earlier changes are redundant. Hence, I have merged all the changes to this branch. Do share your thoughts

@stormpython
Copy link
Contributor

@gauravsinghania with the new changes there is a bug when you Split Charts. The error is:
screen shot 2015-07-16 at 2 12 20 pm

It produces an empty chart although data is present.
screen shot 2015-07-16 at 2 13 49 pm

@gauravsinghania
Copy link
Contributor Author

@stormpython thanks, will have a look.

@gauravsinghania
Copy link
Contributor Author

@stormpython fixed. Thanks for pointing out that flow.

@stormpython
Copy link
Contributor

Ok, this is looking good to me! Passing it on to someone else to review.

@stormpython stormpython assigned rashidkpc and unassigned stormpython Jul 20, 2015
@gauravsinghania
Copy link
Contributor Author

@stormpython thanks.

@marcinkubica
Copy link

Problem created by this code is it maps colors across all indexes and values alphabetically.
This creates oddly (and ugly) looking color palettes and makes color scheme inconsistent across dashboards.

This feature will look much better limited to the dashboard rather than spawning everywhere.

Or better, by giving user the option to choose if user wants this feature, or feature across all indexes, or per dashboard.

Additionally this is worsen by a a sudden remap of a value in the Legend from it's original name to 'Count' and color change to green when that value is filtered.

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

Successfully merging this pull request may close these issues.

5 participants