Example usage for org.jfree.chart.renderer.xy XYAreaRenderer2 setBaseStroke

List of usage examples for org.jfree.chart.renderer.xy XYAreaRenderer2 setBaseStroke

Introduction

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

Prototype

public void setBaseStroke(Stroke stroke) 

Source Link

Document

Sets the base stroke and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:org.jstockchart.plot.TimeseriesPlot.java

private XYPlot createVolumePlot() {
    Font axisFont = new Font("Arial", 0, 12);
    Stroke stroke = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.CAP_SQUARE, 0.0f,
            new float[] { 1.0f, 1.0f }, 1.0f);
    VolumeArea volumeArea = timeseriesArea.getVolumeArea();
    LogicNumberAxis logicVolumeAxis = volumeArea.getLogicVolumeAxis();
    Color volumeColor = new Color(86, 126, 160);
    volumeArea.setVolumeColor(volumeColor);
    CFXNumberAxis volumeAxis = new CFXNumberAxis(logicVolumeAxis.getLogicTicks());
    volumeAxis.setAxisLineVisible(false);
    volumeAxis.setCustomTickCount(2);/*from   w  w  w.ja  v a 2s.c o  m*/
    volumeAxis.setTickLabelPaint(volumeColor);
    volumeAxis.setUpperBound(logicVolumeAxis.getUpperBound());
    volumeAxis.setTickLabelFont(axisFont);
    volumeAxis.setTickMarkStroke(stroke);
    volumeAxis.setLowerBound(logicVolumeAxis.getLowerBound());
    volumeAxis.setAutoRangeIncludesZero(true);
    XYAreaRenderer2 volumeRenderer = new XYAreaRenderer2();
    volumeRenderer.setSeriesPaint(0, volumeArea.getVolumeColor());
    //volumeRenderer.setShadowVisible(false);
    volumeRenderer.setSeriesStroke(0, stroke);
    volumeRenderer.setBaseStroke(stroke);
    XYPlot plot = new XYPlot(new TimeSeriesCollection(dataset.getVolumeTimeSeries()), null, volumeAxis,
            volumeRenderer);
    plot.setBackgroundPaint(volumeArea.getBackgroudColor());
    plot.setOrientation(volumeArea.getOrientation());
    plot.setRangeAxisLocation(volumeArea.getVolumeAxisLocation());
    plot.setRangeMinorGridlinesVisible(false);

    Stroke outLineStroke = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.CAP_SQUARE, 0.0f,
            new float[] { 1.0f, 1.0f }, 1.0f);
    Stroke gridLineStroke = new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0.0f,
            new float[] { 2.0f, 2.0f }, 1.0f);
    // plot.setBackgroundPaint(Color.RED);
    plot.setRangeGridlineStroke(gridLineStroke);
    plot.setDomainGridlineStroke(gridLineStroke);
    plot.setRangeGridlinesVisible(true);
    plot.setDomainGridlinesVisible(true);
    plot.setOutlineVisible(true);
    plot.setOutlineStroke(outLineStroke);
    plot.setOutlinePaint(Color.black);
    plot.setRangeZeroBaselineVisible(true);
    return plot;
}