Reputation: 3
I have created an AreaChart
with SceneBuilder with NumberAxis
on X axis
and NumberAxis
on Y axis.
@FXML
private AreaChart<Number,Number> areaChart;
and FXML:
<AreaChart fx:id="areaChart" alternativeColumnFillVisible="true" createSymbols="false" style="-fx-horizontal-grid-lines-color: white;" title="Altura durante la sesión">
<xAxis>
<NumberAxis fx:id="areaX" animated="false" label="Distancia (metros)" style="axis_color: white;" />
</xAxis>
<yAxis>
<NumberAxis fx:id="areaY" label="Altura (metros)" style="axis_color: white;" />
</yAxis>
I want by pressing a button convert that areaChart to an AreaChart
with a NumberAxis
on Y axis and a CategoryAxis
on X axis.
because I have to make a Heigth x Distance chart and then by pressing a button convert that chart to Height x Time chart
and the result after pressing the button has to be this:
<AreaChart fx:id="areaChart" alternativeColumnFillVisible="true" createSymbols="false" style="-fx-horizontal-grid-lines-color: white;" title="Altura durante la sesión">
<xAxis>
<CategoryAxis fx:id="areaX" animated="false" label="Distancia (metros)" style="axis_color: white;" />
</xAxis>
<yAxis>
<NumberAxis fx:id="areaY" label="Altura (metros)" style="axis_color: white;" />
</yAxis>
Upvotes: 0
Views: 1925
Reputation: 159290
I don't think it is a good idea to change try to change the axis type of a chart (I'm not even sure if you can do that).
Instead, I advise:
That should allow you to display the appropriate chart with the appropriate axis type on demand.
Upvotes: 1