-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Coloring of new series doesn't take current colors of the chart into account #5990
Comments
Hi @newlukai Thanks for reporting this. However, I don't think it's a bug:
You can always set colors array in options: http://jsfiddle.net/nw53pbwq/ or alternatively set color for each series separately. |
Hi @pawelfus , sorry for the late answer, I didn't have a chance to care about this issue. In my opinion, it is still a bug. Going one step back and thinking about a simple set with two entities: one you would call the first one, the other is the second one. Once I remove those two entities, leaving the set empty, and put two other entities in this set, why should these replacing entities be a third one and a fourth one? What do you think? In my application I create charts dynamically. If Highcharts would reset the colors counter to zero once all series are removed, I wouldn't need to count the displayed series and adjust the colors array accordingly. |
Thank you for the feedback! I see your point and I agree, that would be convenient in a certain cases. Actually, there is a discussion about the same issue: #6168 and #6138. Will |
@pawelfus chart.resetColorCounter() will defiantly be helpful. at my company, all charts must have the same color in a certain order. if you add chart.resetColorCounter() can you also add chart.resetMarkerCounter() |
Ref #6138 colorCounter and symbolCounter is now automatically reset when there are no series in the chart. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions! |
Expected behaviour
After removing a series from the chart a newly added series should be colored in the same color the removed series used.
Actual behaviour
The new series is colored in the next color available in the options.colors array.
Live demo with steps to reproduce
Replacing all series
In the live demo use the "Another chart" button to dynamically change the series displayed. The two series are drawn using the primary and secondary color. Hitting the button again, removes the series and adds them again. This time, the series are drawn using the third and fourth color. Would be great if the coloring would start at zero again.
chart.colorCount doesn't work
An approach to start coloring with the primary color after removing all series would be to limit the color count in chart.colorCount. But as you can see (hit "New series" multiple times), this setting doesn't work as expected, the colors are chosen from the complete options.colors array.
Affected browser(s)
All, I think.
The text was updated successfully, but these errors were encountered: