Showing data points

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
RedSoxFan620
Posts: 2
Joined: Fri May 30, 2008 9:43 pm

Showing data points

Post by RedSoxFan620 » Fri May 30, 2008 9:44 pm

I guess this is a stupid question, but how do I get data points to show? I did a createXYLineChart and it makes a line, but it doesn't show the points. I've tried for hours but I have no idea how to make it show the points.

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Re: Showing data points

Post by RichardWest » Fri May 30, 2008 10:38 pm

RedSoxFan620 wrote:I guess this is a stupid question, but how do I get data points to show?
This is how you do it given the JFreeChart object returned by ChartFactory.createXYLineChart():

Code: Select all

JFreeChart chart = createXYLineChart(...);
XYPlot plot = chart.getXYPlot();
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer)plot.getRenderer();
renderer.setBaseShapesVisible(true);
Sometimes it is just easier to build the JFreeChart from the ground up without using the ChartFactory methods if you want a more custom plot.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

Locked