Search code examples
javajavafxjfreechart

How display point values on LineChart Java/JavaFX


How display in all points values on Line Chart Java/JavaFX:

enter image description here


Solution

  • This question talks about showing the values on hoover JavaFX LineChart Hover Values

    You can likey adapt that solution to show the values all of the time.

    Here is the example code refrenced there https://gist.github.com/jewelsea/4681797

    This code is untested but I would start by using the example with this modification

     HoveredThresholdNode(int priorValue, int value) {
          setPrefSize(15, 15);
    
          final Label label = createDataThresholdLabel(priorValue, value);
          getChildren().setAll(label);
          toFront();
    
        }
    

    From there you can start to pull away the parts you dont need.