Example usage for org.jfree.chart.axis QuarterDateFormat QuarterDateFormat

List of usage examples for org.jfree.chart.axis QuarterDateFormat QuarterDateFormat

Introduction

In this page you can find the example usage for org.jfree.chart.axis QuarterDateFormat QuarterDateFormat.

Prototype

public QuarterDateFormat(TimeZone zone, String[] quarterSymbols) 

Source Link

Document

Creates a new instance for the specified time zone.

Usage

From source file:org.jfree.chart.demo.QuarterDateFormatDemo.java

private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Legal & General Unit Trust Prices", "Date",
            "Price Per Unit", xydataset, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    PeriodAxis periodaxis = new PeriodAxis("Quarter", new Quarter(), new Quarter());
    periodaxis.setAutoRangeTimePeriodClass(org.jfree.data.time.Quarter.class);
    PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[1];
    aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Quarter.class,
            new QuarterDateFormat(TimeZone.getDefault(), QuarterDateFormat.ROMAN_QUARTERS));
    periodaxis.setLabelInfo(aperiodaxislabelinfo);
    xyplot.setDomainAxis(periodaxis);// ww w. j  ava2 s  . co m
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);
    org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    if (xyitemrenderer instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer;
        xylineandshaperenderer.setBaseShapesVisible(true);
        xylineandshaperenderer.setBaseShapesFilled(true);
    }
    return jfreechart;
}