Andrew
Andrew

Reputation: 419

Set LineChart(javafx) style to a child element

I want to use 2 objects with one line on each. LineChart

I set color like this .chart-series-line {-fx-stroke: #ff0099; } and lines changed both. But color on the lines must be different. How can i changed lines separately?

Upvotes: 1

Views: 166

Answers (1)

James_D
James_D

Reputation: 209330

Just set a CSS id on each line chart, e.g.

LineChart leftChart = new LineChart(...);
leftChart.setId("left");

LineChart rightChart = new LineChart(...);
rightChart.setId("right");

(or if you are using FXML

<LineChart id="left" ... >

etc)

and then in your css file you can do

#left .chart-series-line {-fx-stroke: #ff0099; }

etc.

Upvotes: 1

Related Questions