From the course: Data Science for Java Developers

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Displaying a scatterplot

Displaying a scatterplot

- [Instructor] All right, and now that we have our scatter chart, what we're going to need to do is add all of the data points that we have up here to it. And the way that we have to do that generally with JavaFX is we have to first add all of this data to something called a series, which is basically just a collection of data points. And then we add that series to the chart. So that might seem a little confusing, but basically, that's the way it is. So what this is going to look like is we're going to say Series. We'll call it dataPointSeries. And we're going to say equals new Series. And if you don't want to have this XYChart.Series thing before it, basically what you can do is just say Series and remove that. There we go. All right, so now that we have the series, we're basically going to need to loop through all of our data points here and add those to this Series. So here's what that's going to look like. There…

Contents