List of usage examples for org.jfree.chart.axis PeriodAxisLabelInfo DEFAULT_DIVIDER_PAINT
Paint DEFAULT_DIVIDER_PAINT
To view the source code for org.jfree.chart.axis PeriodAxisLabelInfo DEFAULT_DIVIDER_PAINT.
Click Source Link
From source file:org.webcat.grader.graphs.StackedAreaChart.java
@Override protected JFreeChart generateChart(WCChartTheme chartTheme) { JFreeChart chart = ChartFactory.createStackedXYAreaChart(null, xAxisLabel(), yAxisLabel(), tableXYDataset(), orientation(), true, false, false); XYPlot plot = chart.getXYPlot();/*from w ww.ja va 2s. c om*/ long diff = (long) tableXYDataset().getXValue(0, tableXYDataset().getItemCount() - 1) - (long) tableXYDataset().getXValue(0, 0); GregorianCalendar calDiff = new GregorianCalendar(); calDiff.setTime(new NSTimestamp(diff)); // Set the time axis PeriodAxis axis = new PeriodAxis(null); // ( "Date" ); PeriodAxisLabelInfo labelinfo[] = new PeriodAxisLabelInfo[2]; if (calDiff.get(Calendar.DAY_OF_YEAR) > 1) { axis.setTimeZone(TimeZone.getTimeZone(user().timeZoneName())); axis.setAutoRangeTimePeriodClass(org.jfree.data.time.Day.class); axis.setMajorTickTimePeriodClass(org.jfree.data.time.Week.class); labelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("d"), PeriodAxisLabelInfo.DEFAULT_INSETS, chartTheme.smallFont(), chartTheme.textColor(), true, PeriodAxisLabelInfo.DEFAULT_DIVIDER_STROKE, PeriodAxisLabelInfo.DEFAULT_DIVIDER_PAINT); labelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Month.class, new SimpleDateFormat("MMM"), PeriodAxisLabelInfo.DEFAULT_INSETS, chartTheme.smallFont(), chartTheme.textColor(), true, PeriodAxisLabelInfo.DEFAULT_DIVIDER_STROKE, PeriodAxisLabelInfo.DEFAULT_DIVIDER_PAINT); } else { axis.setAutoRangeTimePeriodClass(org.jfree.data.time.Hour.class); labelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("ha"), PeriodAxisLabelInfo.DEFAULT_INSETS, chartTheme.smallFont(), chartTheme.textColor(), true, PeriodAxisLabelInfo.DEFAULT_DIVIDER_STROKE, PeriodAxisLabelInfo.DEFAULT_DIVIDER_PAINT); labelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Month.class, new SimpleDateFormat("MMM-d"), PeriodAxisLabelInfo.DEFAULT_INSETS, chartTheme.smallFont(), chartTheme.textColor(), true, PeriodAxisLabelInfo.DEFAULT_DIVIDER_STROKE, PeriodAxisLabelInfo.DEFAULT_DIVIDER_PAINT); } axis.setLabelInfo(labelinfo); plot.setDomainAxis(axis); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); NumberTickUnit tickUnit = new NumberTickUnit(5); rangeAxis.setTickUnit(tickUnit); XYAreaRenderer2 renderer = (XYAreaRenderer2) plot.getRenderer(); renderer.setOutline(true); renderer.setAutoPopulateSeriesOutlinePaint(true); plot.setDomainMinorGridlinesVisible(false); plot.setRangeMinorGridlinesVisible(false); if (markValue != null) { plot.setDomainCrosshairVisible(true); plot.setDomainCrosshairValue(markValue.doubleValue()); plot.setDomainCrosshairPaint(Color.red); plot.setDomainCrosshairStroke(MARKER_STROKE); } chart.getLegend().setBorder(0, 0, 0, 0); return chart; }