từ mã này tôi có thể tạo biểu đồ thanh 10 thanh bây giờ tôi muốn biết làm thế nào để hiển thị giá trị của mỗi thanh trên cùng của thanh giống như hình ảnh kèm theo: làm thế nào để hiển thị giá trị thanh trên thanh JavaFX
ở đây là mã:
public class BarChartSample extends Application {
@Override public void start(Stage stage) {
stage.setTitle("Bar Chart Sample");
final CategoryAxis xAxis = new CategoryAxis();
final NumberAxis yAxis = new NumberAxis();
final BarChart<String,Number> bc =
new BarChart<String,Number>(xAxis,yAxis);
bc.setTitle("Country Summary");
xAxis.setLabel("bars");
yAxis.setLabel("Value");
XYChart.Series series1 = new XYChart.Series();
series1.setName("...");
for(int i=0;i<10;i++)
{
//here i want to change color of bar if value of i is >5 than red if i>8 than blue
series1.getData().add(new XYChart.Data("Value", i));
}
}
public static void main(String[] args) {
launch(args);
}
}
http://stackoverflow.com/a/41494789/4469105 liên quan – r3r57