'Overlapping data point label Name or lines in java XYChart.series

I write the data point names, but the names overlap, some or the texts overlap the lines, how can I prevent this? Is there a function to understand the lines of overlapping text on the chart or what kind of algorithm should I develop?

I write addlabel function on the below. How to write code reading data point name easily not overlapping label name and lines.

private void addlabels(XYChart.Series<Number,Number> value)
{

   Label label=new Label(value.getname());
   label.toFront();
   Pane pane=new Pane(label);
   pane.toFront();
   pane.setShape(new Circle(6));
for(int index=0;index<value.getData().size();index++)
{
    label.translateXProperty().bind(label.heightProperty().divide(-1.5));
    label.translateYProperty().bind(label.heightProperty().divide(-1.5));
    value.getData().get(index).setNode(pane);

}   

}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source