How to set specific color to JavaFX XYChart.Series?

In general the way preferred way to style charts is without code, using only css stylesheets as jschoen recommends. Additionally, if further customization is required, you can use css lookups from code to dig into the the nodes generated from series data and apply various additional css styling.

Here is information about dynamically changing a JavaFX line chart style and a sample program to go with the answer. In the sample app, all of the additional css styling is done via a setStyle call from code. Using a similar lookup technique, you could get access to the series nodes to apply an appropriate stylesheet styleclass rather than a setStyle call.

Leave a Comment