Example usage for org.jfree.chart.renderer.category LineAndShapeRenderer setLinesVisible

List of usage examples for org.jfree.chart.renderer.category LineAndShapeRenderer setLinesVisible

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.category LineAndShapeRenderer setLinesVisible.

Prototype

public void setLinesVisible(boolean visible) 

Source Link

Document

Sets a flag that controls whether or not lines are drawn between the items in ALL series, and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:com.tonbeller.jpivot.chart.ChartFactory.java

/**
 * Creates a line chart with default settings.
 *
 * @param title  the chart title.//from  w  ww  .j av a2 s.  c o m
 * @param categoryAxisLabel  the label for the category axis.
 * @param valueAxisLabel  the label for the value axis.
 * @param data  the dataset for the chart.
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return a line chart.
 */
public static JFreeChart createLineChart(String title, java.awt.Font titleFont, String categoryAxisLabel,
        String valueAxisLabel, CategoryDataset data, PlotOrientation orientation, boolean legend,
        boolean tooltips, boolean urls, CategoryURLGenerator urlGenerator) {

    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);

    LineAndShapeRenderer renderer = new LineAndShapeRenderer();
    renderer.setLinesVisible(true);
    renderer.setShapesVisible(false);
    if (tooltips) {
        renderer.setToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
        renderer.setItemURLGenerator(urlGenerator);
    }
    CategoryPlot plot = new CategoryPlot(data, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart(title, titleFont, plot, legend);

    return chart;

}