I am trying to display data for a user with LineChart in JavaFX. I have an array of Float (and not a primitive object, as in Float[] ), which is ready to be added, which can be anywhere from 512 to 4096 points.
All the examples and help for LineChart show that data should be added point by point using XYChart.Series.getData().add(new XYChart.Data(X, Y)) , where X will be the index and Y will be the value in Float [index ]. This is really very slow, since this approach requires a loop through the array, but it works. I would like LineChart to LineChart updated at 30FPS, but now it is less than 1FPS: /
Is there a faster way when I can just toss an array in the JavaFX LineChart class and draw it without scrolling and adding each point?
EDITOR (solution found) :
srm, this concept works!
In the first run, just populate XYChart.Series new XYChart.Data(X,Y) . Then loop and retrieve and update using XYChart.Series.get(index).setYData(NewValue)
java javafx
Austin
source share