Search in sources :

Example 1 with XYAreaRenderer2

use of org.jfree.chart.renderer.xy.XYAreaRenderer2 in project cubrid-manager by CUBRID.

the class CombinedBarTimeSeriesChart method createSeriesChart.

/**
	 * Create the series chart
	 * 
	 * @return an instance of series chart
	 */
private JFreeChart createSeriesChart() {
    if (isAreaRender) {
        seriesdataset = createTableSeriesDataset();
    } else {
        seriesdataset = createTimeSeriesDataset();
    }
    JFreeChart chart = ChartFactory.createTimeSeriesChart("", "", "", seriesdataset, false, false, false);
    chart.setBorderVisible(false);
    chart.setBorderStroke(new BasicStroke(0.0f));
    //plot
    XYPlot xyplot = (XYPlot) chart.getPlot();
    xyplot.setOutlineVisible(false);
    RectangleInsets rectangleInsets = new RectangleInsets();
    xyplot.setAxisOffset(rectangleInsets);
    xyplot.setDomainGridlineStroke(new BasicStroke(0.4f));
    xyplot.setRangeGridlineStroke(new BasicStroke(0.4f));
    xyplot.setBackgroundPaint(Color.BLACK);
    xyplot.setDomainGridlinePaint(new Color(0, 128, 64));
    xyplot.setRangeGridlinePaint(new Color(0, 128, 64));
    if (isAreaRender) {
        XYAreaRenderer2 render = new StackedXYAreaRenderer2();
        render.setSeriesPaint(0, Color.GREEN);
        render.setSeriesPaint(1, Color.RED);
        xyplot.setRenderer(render);
    } else {
        XYLineAndShapeRenderer render = (XYLineAndShapeRenderer) xyplot.getRenderer();
        render.setSeriesPaint(0, Color.GREEN);
        render.setSeriesPaint(1, Color.RED);
    }
    //dateAxis
    DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
    dateaxis.setFixedAutoRange(300000d);
    dateaxis.setLowerMargin(0.0D);
    dateaxis.setUpperMargin(0.0D);
    dateaxis.setVisible(isShowSeriesAxis);
    numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setVisible(isShowSeriesAxis);
    numberaxis.setRange(0 - 0.5, barMax + 0.5);
    return chart;
}
Also used : BasicStroke(java.awt.BasicStroke) StackedXYAreaRenderer2(org.jfree.chart.renderer.xy.StackedXYAreaRenderer2) DateAxis(org.jfree.chart.axis.DateAxis) XYPlot(org.jfree.chart.plot.XYPlot) Color(java.awt.Color) XYLineAndShapeRenderer(org.jfree.chart.renderer.xy.XYLineAndShapeRenderer) RectangleInsets(org.jfree.ui.RectangleInsets) JFreeChart(org.jfree.chart.JFreeChart) XYAreaRenderer2(org.jfree.chart.renderer.xy.XYAreaRenderer2) StackedXYAreaRenderer2(org.jfree.chart.renderer.xy.StackedXYAreaRenderer2)

Aggregations

BasicStroke (java.awt.BasicStroke)1 Color (java.awt.Color)1 JFreeChart (org.jfree.chart.JFreeChart)1 DateAxis (org.jfree.chart.axis.DateAxis)1 XYPlot (org.jfree.chart.plot.XYPlot)1 StackedXYAreaRenderer2 (org.jfree.chart.renderer.xy.StackedXYAreaRenderer2)1 XYAreaRenderer2 (org.jfree.chart.renderer.xy.XYAreaRenderer2)1 XYLineAndShapeRenderer (org.jfree.chart.renderer.xy.XYLineAndShapeRenderer)1 RectangleInsets (org.jfree.ui.RectangleInsets)1