I've been learning JFreeChart lately, and came across a scatter plot in this tutorial series. Now, I understand how to create and modify it, but I'm curious if there is a way to run a line through it as well.
Like a combination of both the line and scatter graphs. Is something like this possible?
JFreeChart Scatter + Line
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: JFreeChart Scatter + Line
Yes. If you're using a ChartFactory to create your scatter plot, note that it instantiates an XYLineAndShapeRenderer. One approach then is to add two series, one for the shapes and one for the line, setting the latter's visibility properties as seen here. Alternatively, look among the org.jfree.chart.annotations, e.g. XYLineAnnotation.