Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFx 2.x: BarChart with both axes as numbers

1) I want a BarChart where both axes are numbers(<Number, Number>), but it seems like this isn't supported and that you need to have a category and a number axis.

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

2) Is it possibile to use LineChart to plot bars instead of BarChart class to get a histogram plot ?

like image 353
famedoro Avatar asked Sep 29 '12 18:09

famedoro


1 Answers

Found a good solution: I suggest to do in this way

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

in this way you can use LineChart to plot bars

also, if you want to remove symbols from AreaChart you can accomplish this by using css

.chart-area-symbol 
            { -fx-background-color: null, null; }
like image 127
Alberto acepsut Avatar answered Oct 20 '22 20:10

Alberto acepsut