Eli Duenisch
Eli Duenisch

Reputation: 526

setting more than eight colors for data series in JavaFX ScatterChart

I'm trying to set the colors of eleven data series in a ScatterChart. Unfortunately JavaFX repeats colors and symbols every eight series due to the nextClearBit which is set to mudulo eight by design. There is a solution to overcome this by setting the colors manually for each data series in CSS like:

.default-color0.chart-series-line { -fx-stroke: #e9967a; }
.default-color1.chart-series-line { -fx-stroke: #f0e68c; }
.default-color2.chart-series-line { -fx-stroke: #dda0dd; }

...and so on.

This works for LineCharts. So I tryed a similar approach for my ScatterChart, but...

.default-color0.chart-symbol { -fx-stroke: #e9967a; }
.default-color1.chart-symbol { -fx-stroke: #f0e68c; }
.default-color2.chart-symbol { -fx-stroke: #dda0dd; }

...and so on works until...

.default-color8.chart-symbol { -fx-stroke: #e9a0dd; }

At this point Java ignores my CSS and jumps to the formatting of the first data series following the nextClearBit rule. Does anyone know how to fix this?

Upvotes: 2

Views: 1284

Answers (1)

ItachiUchiha
ItachiUchiha

Reputation: 36742

JavaFX Scatter chart repeats its color combination after the 8th series. So there is no styleclass .default-color8 in the JavaFX style css file modena.css.

If you want to color your series, you should be depend on the styleclass which represents the series and not the color itself.

Try using series0, .series1, and so on, as your style class instead of .default-color0, .default-color1 ...

Upvotes: 3

Related Questions