How to add text on horizontal line with JavaFX BarChart
问题 I use an extended class of BarChart to add vertical lines and text on top of bars. This works fine but I want to display a small text at the top right of the horizontal line. I tried this without success: public void addHorizontalValueMarker(Data<X, Y> marker) { Objects.requireNonNull(marker, "the marker must not be null"); if (horizontalMarkers.contains(marker)) return; Line line = new Line(); line.setStroke(Color.RED); marker.setNode(line); getPlotChildren().add(line); // Adding a label