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;
}
Aggregations