-
Bug
-
Resolution: Fixed
-
P3
-
None
-
JavaFX 1.2 Windows Vista Business
The following code creates a BarChart with three categories of data. If run as shown, it works and gives the expected result.
-------------------------------------------------------------------------------------------
package javafxcharts;
import javafx.scene.Scene;
import javafx.scene.chart.BarChart;
import javafx.stage.Stage;
import javafx.scene.chart.part.CategoryAxis;
import javafx.scene.chart.part.NumberAxis;
var categories = [ "Duration", "EVA Time", "Samples (kg)" ];
var seriesData = [
BarChart.Series {
name: "Apollo 11"
data: [
BarChart.Data { category: "Duration" value: 195.5 }
BarChart.Data { category: "EVA Time" value: 2.5 }
BarChart.Data { category: "Samples (kg)" value: 22 }
]
}
BarChart.Series {
name: "Apollo 15"
data: [
BarChart.Data { category: "Duration" value: 295.2 }
BarChart.Data { category: "EVA Time" value: 19.2 }
BarChart.Data { category: "Samples (kg)" value: 76.8 }
]
}
BarChart.Series {
name: "Apollo 16"
data: [
BarChart.Data { category: "Duration" value: 265.9 }
BarChart.Data { category: "EVA Time" value: 20.3 }
BarChart.Data { category: "Samples (kg)" value: 94.7 }
]
}
BarChart.Series {
name: "Apollo 17"
data: [
BarChart.Data { category: "Duration" value: 301.8 }
BarChart.Data { category: "EVA Time" value: 22.1 }
BarChart.Data { category: "Samples (kg)" value: 110.5 }
]
}
];
Stage {
title: "Bar Chart #1"
scene: Scene {
content: [
BarChart {
title: "Apollo Lunar Landings"
data: seriesData
categoryAxis: CategoryAxis {
categories: categories
}
valueAxis: NumberAxis {
upperBound: 310
tickUnit: 100
}
}
]
}
}
------------------------------------------------------------
Now if I change the first series to the following, I expected the samples data for the Apollo 11 series to be lost from the chart, but it still appears in the correct location. This leads me to suspect that the category names in the BarChart.Data objects are being ignored:
BarChart.Series {
name: "Apollo 11"
data: [
BarChart.Data { category: "Duration" value: 195.5 }
BarChart.Data { category: "EVA Time" value: 2.5 }
BarChart.Data { category: "Samples (kg)XXXXX" value: 22 } /// CHANGED CATEGORY NAME
]
}
Now if I do this, I get a worse result:
BarChart.Series {
name: "Apollo 11"
data: [
BarChart.Data { category: "EVA Time" value: 2.5 }
BarChart.Data { category: "Samples (kg)" value: 22 }
BarChart.Data { category: "Duration" value: 195.5 }
]
}
The order of items in the series data has been changed and now the bar chart displays the firt data item in the Duration category even though it says it is EVA Time, the second in the EVA Time category and the third in the Samples category.
-------------------------------------------------------------------------------------------
package javafxcharts;
import javafx.scene.Scene;
import javafx.scene.chart.BarChart;
import javafx.stage.Stage;
import javafx.scene.chart.part.CategoryAxis;
import javafx.scene.chart.part.NumberAxis;
var categories = [ "Duration", "EVA Time", "Samples (kg)" ];
var seriesData = [
BarChart.Series {
name: "Apollo 11"
data: [
BarChart.Data { category: "Duration" value: 195.5 }
BarChart.Data { category: "EVA Time" value: 2.5 }
BarChart.Data { category: "Samples (kg)" value: 22 }
]
}
BarChart.Series {
name: "Apollo 15"
data: [
BarChart.Data { category: "Duration" value: 295.2 }
BarChart.Data { category: "EVA Time" value: 19.2 }
BarChart.Data { category: "Samples (kg)" value: 76.8 }
]
}
BarChart.Series {
name: "Apollo 16"
data: [
BarChart.Data { category: "Duration" value: 265.9 }
BarChart.Data { category: "EVA Time" value: 20.3 }
BarChart.Data { category: "Samples (kg)" value: 94.7 }
]
}
BarChart.Series {
name: "Apollo 17"
data: [
BarChart.Data { category: "Duration" value: 301.8 }
BarChart.Data { category: "EVA Time" value: 22.1 }
BarChart.Data { category: "Samples (kg)" value: 110.5 }
]
}
];
Stage {
title: "Bar Chart #1"
scene: Scene {
content: [
BarChart {
title: "Apollo Lunar Landings"
data: seriesData
categoryAxis: CategoryAxis {
categories: categories
}
valueAxis: NumberAxis {
upperBound: 310
tickUnit: 100
}
}
]
}
}
------------------------------------------------------------
Now if I change the first series to the following, I expected the samples data for the Apollo 11 series to be lost from the chart, but it still appears in the correct location. This leads me to suspect that the category names in the BarChart.Data objects are being ignored:
BarChart.Series {
name: "Apollo 11"
data: [
BarChart.Data { category: "Duration" value: 195.5 }
BarChart.Data { category: "EVA Time" value: 2.5 }
BarChart.Data { category: "Samples (kg)XXXXX" value: 22 } /// CHANGED CATEGORY NAME
]
}
Now if I do this, I get a worse result:
BarChart.Series {
name: "Apollo 11"
data: [
BarChart.Data { category: "EVA Time" value: 2.5 }
BarChart.Data { category: "Samples (kg)" value: 22 }
BarChart.Data { category: "Duration" value: 195.5 }
]
}
The order of items in the series data has been changed and now the bar chart displays the firt data item in the Duration category even though it says it is EVA Time, the second in the EVA Time category and the third in the Samples category.