Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFx Scene Builder Choose Bar Chart Axes Type

I am trying to create a bar chart where the x-axis is a Number axis, and the y-axis is a Category axis. This way the bars will be starting on the y-axis and extend to the right. However, it seems as though Scene Builder will only default to allowing the Number axis be the y-axis, and the Category axis to be the x-axis.

Does anyone know a work-around to achieve what I am trying to accomplish? Or am I missing some functionality options in Scene Builder?

Thanks!

like image 870
Erik Owen Avatar asked Feb 08 '14 05:02

Erik Owen


1 Answers

I've the same problem. From the GUI isn't possible to change axis tipe. If you open the fxml you can manually change them:

 <BarChart fx:id="chart" focusTraversable="false" horizontalGridLinesVisible="true" horizontalZeroLineVisible="true" legendVisible="false" mouseTransparent="false" prefHeight="385.9999000000025" prefWidth="599.9998779296875" verticalGridLinesVisible="false" verticalZeroLineVisible="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
  <yAxis>
    <CategoryAxis side="LEFT" />
  </yAxis>
  <xAxis>
    <NumberAxis side="BOTTOM" />
  </xAxis>
</BarChart>

This example revert category with number axis (what i need).

like image 131
Matteo Gatto Avatar answered Sep 22 '22 08:09

Matteo Gatto