List of usage examples for org.jfree.chart.renderer LineAndShapeRenderer setDrawShapes
public void setDrawShapes(boolean draw)
From source file:hr.restart.util.chart.ChartXYZ.java
/** * Creates a LINE CHART./*from w ww. ja v a 2 s .c o m*/ * * @param dataset The org.jfree.data.CategoryDataset * @param title The title * @return org.jfree.chart.JFreeChart */ final private JFreeChart createLineChart(final CategoryDataset dataset, String title) { // create the chart... final JFreeChart chart = ChartFactory.createLineChart(title, // chart title "", // domain axis label "", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); //print the subtitles java.util.List subs = getSubtitles(); if (subs != null) for (int i = 0; i < subs.size(); i++) { chart.addSubtitle(new TextTitle(subs.get(i).toString())); } // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... final StandardLegend legend = (StandardLegend) chart.getLegend(); legend.setDisplaySeriesShapes(true); legend.setShapeScaleX(1.5); legend.setShapeScaleY(1.5); legend.setDisplaySeriesLines(true); final CategoryPlot plot = (CategoryPlot) chart.getPlot(); //plot.setBackgroundPaint(Color.lightGray); //plot.setRangeGridlinePaint(Color.white); // customise the range axis... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRangeIncludesZero(true); // customise the renderer... final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setDrawShapes(true); adjustLineRenderer(renderer); // renderer.setSeriesStroke( // 0, new BasicStroke( // 2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, // 1.0f, new float[] {10.0f, 6.0f}, 0.0f // ) // ); // renderer.setSeriesStroke( // 1, new BasicStroke( // 2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, // 1.0f, new float[] {6.0f, 6.0f}, 0.0f // ) // ); // renderer.setSeriesStroke( // 2, new BasicStroke( // 2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, // 1.0f, new float[] {2.0f, 6.0f}, 0.0f // ) // ); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }