JavaFx 2.x: BarChart with both axes as numbers

1) I want BarChart, where both axes are numbers ( <Number, Number>), but it looks like this is not supported and that you need to have a category and a numerical axis.

Is there a way to override the BarChart class to get both axes as Number, Number?

2) Is it possible to use LineChart to build charts instead of the BarChart class to get a histogram chart?

+5
source share
2 answers

Found a good solution: I propose to do so

series.getData().add(new XYChart.Data(i, 0));
        series.getData().add(new XYChart.Data(i, listValue));          
        series.getData().add(new XYChart.Data(i, 0));

this way you can use LineChart to plot

also if you want to remove characters from AreaChart you can accomplish this using css

.chart-area-symbol 
            { -fx-background-color: null, null; }
+1
source

You can try this solution

XYChart.Series series = new XYChart.Series();                        
        series.getData().add(new XYChart.Data(i, i));
        series.getData().add(new XYChart.Data(i, listValue));            
        lineChart.getData().addAll(series);

but I warn you that it is very slow compared to the axis of the number

+2
source

All Articles