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!

有帮助吗?

解决方案

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).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top