Example usage for org.jfree.chart.renderer.xy StandardXYItemRenderer setDrawSeriesLineAsPath

List of usage examples for org.jfree.chart.renderer.xy StandardXYItemRenderer setDrawSeriesLineAsPath

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.xy StandardXYItemRenderer setDrawSeriesLineAsPath.

Prototype

public void setDrawSeriesLineAsPath(boolean flag) 

Source Link

Document

Sets the flag that controls whether or not each series is drawn as a single path.

Usage

From source file:no.met.jtimeseries.chart.RendererFactory.java

public static XYItemRenderer createRenderer(String splineStyle) {
    // render the line with spline
    if (splineStyle.equalsIgnoreCase(SplineStyle.STANDARD)) {
        return new XYSplineRenderer();
    } else if (splineStyle.equalsIgnoreCase(SplineStyle.CARDINAL)) {
        return new XYCardinalSplineRenderer();
    } else {//from  w w  w.ja v  a 2 s  .  c  o m
        // render the line without spline
        StandardXYItemRenderer render = new StandardXYItemRenderer();
        render.setDrawSeriesLineAsPath(true);
        return render;
    }
}

From source file:de.codesourcery.eve.skills.ui.components.impl.PriceHistoryComponent.java

private JPanel createFreeChartPanel2() {

    /*/*from  w w  w.  j a va 2 s .  c o  m*/
     * Price plot.
     */
    final StandardXYItemRenderer renderer1 = new StandardXYItemRenderer();

    renderer1.setDrawSeriesLineAsPath(false);
    final ValueAxis priceAxis = new NumberAxis("ISK");

    currentDataSets.pricePlot = new XYPlot(currentDataSets.prices, null, priceAxis, renderer1);

    currentDataSets.pricePlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    /*
     * Buy/sell volume plot.
     */

    final StandardXYItemRenderer renderer2 = // XYBarRenderer
            new StandardXYItemRenderer();

    final ValueAxis volumeAxis = new NumberAxis("Units");

    TimeSeriesCollection volumes = new TimeSeriesCollection();

    volumes.addSeries(currentDataSets.buyVolume);
    volumes.addSeries(currentDataSets.sellVolume);

    currentDataSets.volumePlot = new XYPlot(volumes, null, volumeAxis, renderer2);

    currentDataSets.volumePlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    /*
     * Combined plot.
     */

    final ValueAxis dateAxis = new DateAxis("Date");

    final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(dateAxis);
    plot.setGap(10.0);
    plot.add(currentDataSets.pricePlot, 2);
    plot.add(currentDataSets.volumePlot, 1);

    plot.setOrientation(PlotOrientation.VERTICAL);

    /*
     * Create chart.
     */

    chart = new JFreeChart(item.getName(), JFreeChart.DEFAULT_TITLE_FONT, plot, true);

    chart.setBackgroundPaint(Color.white);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    final XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
    }

    final DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd"));

    changeDateRange((DisplayRange) this.dateRangeChooser.getSelectedItem());

    // display chart
    ChartPanel chartPanel = new ChartPanel(chart);
    //      chartPanel.setMouseZoomable(true, false);
    return chartPanel;
}