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
XYChart and removing the lines
Re: XYChart and removing the lines
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;
}
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;
}
Re: XYChart and removing the lines
Or, along the same lines (but without modifying the JFreeChart source code):
XYPlot plot = myChart.getXYPlot();
plot.setXYItemRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES));
Regards,
DG.
XYPlot plot = myChart.getXYPlot();
plot.setXYItemRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES));
Regards,
DG.