我有BarChart
private void fillChartOpinion2() {
XYChart.Series<String, Integer> chartSeries = new XYChart.Series<>();
chartSeries.setName("NFS");
Calendar calendar = Calendar.getInstance();
for(Opinion opinion : opinionList) {
calendar.setTimeInMillis(opinion.getDateProperty().getTime());
ObservableList<XYChart.Data<String,Integer>> observableData = FXCollections.observableArrayList();
XYChart.Data<String,Integer> chartData = new XYChart.Data<>(String.valueOf(calendar.get(Calendar.HOUR_OF_DAY)),opinion.getOpinionProperty());
Tooltip tooltip = new Tooltip();
tooltip.setText("test");
observableData.add(chartData);
chartSeries.setData(observableData);
Tooltip.install(chartData.getNode(),tooltip);
}
opinionChart.getData().clear();
opinionChart.getData().addAll(chartSeries);
}
看起来像:
但我无法将工具提示设置到图表的每一列...... 我的代码不起作用。
当鼠标光标在列区域中或单击列区域时如何操作?