Remove the pointers from the chart?


Question

enter image description here

This is a simple UI I made to learn the charts API in JavaFX. The AreaChart looks great however, I was wondering if it is possible to hide the tiny dots that signify the plotted values ?

The reason is that as the dots come closer, when the value of X axis increases, they become smaller and harder to comprehend. Sometimes they overlap. In such a situation, the graph would be more legible without the dots.

1
5
12/11/2013 9:15:21 AM

Accepted Answer

Call setNode(...) on the XYChart.Data objects and pass in something invisible.

For example:

XYChart.Data data = new XYChart.Data(x,y);
Rectangle rect = new Rectangle(0, 0);
rect.setVisible(false);
data.setNode(rect);
2
12/11/2013 2:33:14 PM

There is a method to hide the dots (or any other graphical representation of a x/y point).

    final LineChart<Number,Number> lineChart = 
            new LineChart<Number,Number>(xAxis,yAxis);
    //here be code...

    lineChart.setCreateSymbols(false); //hide dots

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon