fair-acc / chart-fx

A scientific charting library focused on performance optimised real-time data visualisation at 25 Hz update rates for data sets with a few 10 thousand up to 5 million data points.
GNU Lesser General Public License v3.0
488 stars 90 forks source link

Customize color schema of XYChart #609

Closed zkycaesar closed 9 months ago

zkycaesar commented 9 months ago

I am trying to change the color schema of XYCharts, so that different XYCharts may have different schema.

I noticed that XYCharts are rendered by a default ErrorDataSetRenderer, and the line color is determined by DefaultRenderColorScheme. If I change the color list of DefaultRenderColorScheme, that will change all the XYCharts, which is not what I want.

Or maybe I can overide ErrorDataSetRenderer, but since drawPolyLineLine is a static method, that seems not to be a workable way.

So is there a proper way to cumtomize color schema for every single Chart?

wirew0rm commented 9 months ago

This is currently being rewritten for the upcoming 11.3.0 release, where you will be able to use a different css defined color scheme per chart by setting the style class on a per chart basis. This is already implemented in #603, there are only small minor issues e.g. with the history renderer being worked out.

I think in the currently released version you might have to set styles on the individual datasets to get the behaviour you want. If you know the maximum amount of datasets you will have in one chart, you could combine the schemes into a single one and set the color scheme offset for each renderer accordingly, but that's more of a hack.

zkycaesar commented 9 months ago

Good idea, I actually know the maximum amount of datasets. That works for me. Thanks!