XYChart and removing the lines

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Eldar Lyn

XYChart and removing the lines

Post by Eldar Lyn » Wed Jun 19, 2002 2:09 pm

Hi,

i just want to know if it's possible to just draw the points in a xychart, and not the line between them?

Thanks in advance

josh

Re: XYChart and removing the lines

Post by josh » Wed Jun 19, 2002 4:04 pm

in chart factor adjust the createXYChart() method:

public static JFreeChart createXYChart(String title, String xAxisLabel, String yAxisLabel,
XYDataset data, boolean legend) {

NumberAxis xAxis = new HorizontalNumberAxis(xAxisLabel);
xAxis.setAutoRangeIncludesZero(false);
NumberAxis yAxis = new VerticalNumberAxis(yAxisLabel);
XYPlot plot = new XYPlot(xAxis, yAxis);
//changed SHAPES_AND_LINES to SHAPES
plot.setXYItemRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES));
JFreeChart chart = new JFreeChart(data, plot, title, JFreeChart.DEFAULT_TITLE_FONT, legend);
return chart;

}

josh

Re: XYChart and removing the lines

Post by josh » Wed Jun 19, 2002 4:04 pm

correction above, class ChartFactory (not chart factor)

David Gilbert

Re: XYChart and removing the lines

Post by David Gilbert » Wed Jun 19, 2002 4:08 pm

Or, along the same lines (but without modifying the JFreeChart source code):

XYPlot plot = myChart.getXYPlot();
plot.setXYItemRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES));

Regards,

DG.

Locked