List of usage examples for org.jfree.chart.axis DateAxis DateAxis
public DateAxis()
From source file:daylightchart.options.chart.BaseChartOptions.java
private static JFreeChart createDummyChart() { final JFreeChart chart = new JFreeChart(new XYPlot()); chart.setTitle(""); final XYPlot plot = chart.getXYPlot(); plot.setDomainAxis(new DateAxis()); plot.setRangeAxis(new DateAxis()); return chart; }
From source file:org.jfree.chart.demo.RelativeDateFormatDemo2.java
private static JFreeChart createChart(IntervalXYDataset intervalxydataset) { JFreeChart jfreechart = ChartFactory.createXYBarChart("RelativeDateFormat Demo 2", "Date ", true, "Time To Complete", intervalxydataset, PlotOrientation.VERTICAL, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); 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); XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer(); xybarrenderer.setDrawBarOutline(false); DateAxis dateaxis = new DateAxis(); RelativeDateFormat relativedateformat = new RelativeDateFormat(); relativedateformat.setShowZeroDays(false); relativedateformat.setSecondFormatter(new DecimalFormat("00")); dateaxis.setDateFormatOverride(relativedateformat); xyplot.setRangeAxis(dateaxis);/*from w ww . j a v a2 s. com*/ return jfreechart; }
From source file:org.larz.aurorareports.ChartCustomizer.java
@Override public void customize(JFreeChart chart, JRChart arg1) { DateAxis xAxis = new DateAxis(); xAxis.setDateFormatOverride(new AuroraDateFormat()); ((XYPlot) chart.getPlot()).setDomainAxis(xAxis); }
From source file:jamel.gui.charts.TimeChart.java
/** * Returns a new time plot./*from w w w .j a v a2s. com*/ * @param timeSeries the time series. * @param valueAxisLabel the value axis label. * @return a new time plot. */ private static Plot newTimePlot(TimeSeries[] timeSeries, String valueAxisLabel) { final TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.setXPosition(TimePeriodAnchor.MIDDLE); for (int i = 0; i < timeSeries.length; i++) { TimeSeries series = timeSeries[i]; if (series == null) throw new RuntimeException(); dataset.addSeries(series); } final XYPlot plot = new XYPlot(dataset, new DateAxis(), new NumberAxis(valueAxisLabel), new XYLineAndShapeRenderer(true, false)); ((DateAxis) plot.getDomainAxis()).setAutoRange(false); ((DateAxis) plot.getDomainAxis()).setTickMarkPosition(DateTickMarkPosition.MIDDLE); plot.setDomainGridlinesVisible(false); return plot; }
From source file:org.sonar.server.charts.jruby.TrendsChart.java
public TrendsChart(int width, int height, String localeKey, boolean displayLegend) { super(width, height); this.displayLegend = displayLegend; seriesById = new TreeMap<Long, TimeSeries>(); plot = new XYPlot(); DateAxis dateAxis = new DateAxis(); dateAxis.setDateFormatOverride(//from ww w . j a va2 s . c o m DateFormat.getDateInstance(DateFormat.SHORT, LocaleUtils.toLocale(localeKey))); plot.setDomainAxis(dateAxis); }
From source file:com.xpn.xwiki.plugin.charts.plots.TimePlotFactory.java
public Plot create(DataSource dataSource, ChartParams params) throws GenerateException, DataSourceException { Class rendererClass = params.getClass(ChartParams.RENDERER); XYItemRenderer renderer;//from ww w . ja v a 2 s . c o m if (rendererClass != null) { try { Constructor ctor = rendererClass.getConstructor(new Class[] {}); renderer = (XYItemRenderer) ctor.newInstance(new Object[] {}); } catch (Throwable e) { throw new GenerateException(e); } } else { renderer = new XYLineAndShapeRenderer(); } ChartCustomizer.customizeXYItemRenderer(renderer, params); DateAxis domainAxis = new DateAxis(); ChartCustomizer.customizeDateAxis(domainAxis, params, ChartParams.AXIS_DOMAIN_PREFIX); NumberAxis rangeAxis = new NumberAxis(); rangeAxis.setAutoRangeIncludesZero(false); // override default ChartCustomizer.customizeNumberAxis(rangeAxis, params, ChartParams.AXIS_RANGE_PREFIX); XYDataset dataset = TimeSeriesCollectionFactory.getInstance().create(dataSource, params); XYPlot plot = new XYPlot(dataset, domainAxis, rangeAxis, renderer); ChartCustomizer.customizeXYPlot(plot, params); return plot; }
From source file:org.sonar.server.charts.deprecated.SparkLinesChart.java
private void configureXAxis() { x = new DateAxis(); x.setTickUnit(new DateTickUnit(DateTickUnit.MONTH, 1)); x.setTickLabelsVisible(false);/*from w w w.jav a 2 s . c om*/ x.setTickMarksVisible(false); x.setAxisLineVisible(false); x.setNegativeArrowVisible(false); x.setPositiveArrowVisible(false); x.setVisible(false); }
From source file:ec.nbdemetra.chainlinking.outlineview.ChainLinkingChart.java
private void configureAxis(XYPlot plot) { NumberAxis xAxis = new NumberAxis(); xAxis.setAutoRangeIncludesZero(false); plot.setRangeAxis(xAxis);/* w ww. j a v a2 s . c o m*/ QuarterDateFormat qdf = new QuarterDateFormat(); DateAxis dateAxis = new DateAxis(); dateAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); dateAxis.setDateFormatOverride(qdf); plot.setDomainAxis(dateAxis); }
From source file:org.operamasks.faces.render.graph.CurveAreaChartRenderer.java
private JFreeChart createXYCurveAreaChart(XYDataset dataset, PlotOrientation orientation) { ValueAxis xAxis;//from ww w.ja v a2s . co m if (dataset instanceof TimeSeriesCollection) { xAxis = new DateAxis(); } else { xAxis = new NumberAxis(); ((NumberAxis) xAxis).setAutoRangeIncludesZero(false); } xAxis.setLowerMargin(0.0); xAxis.setUpperMargin(0.0); NumberAxis yAxis = new NumberAxis(); yAxis.setAutoRangeIncludesZero(false); XYCurveAndShapeRenderer renderer = new XYCurveAndShapeRenderer(true, false); renderer.setDrawArea(true); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(orientation); if (dataset.getSeriesCount() > 1) { plot.setForegroundAlpha(0.75f); } return new JFreeChart(null, null, plot, false); }
From source file:com.od.jtimeseries.ui.visualizer.chart.creator.AbstractXYChartCreator.java
private JFreeChart createChart() { final JFreeChart chart = buildChart(); chart.getXYPlot().setDomainAxis(new DateAxis()); DateAxis dateAxis = (DateAxis) chart.getXYPlot().getDomainAxis(); dateAxis.setDateFormatOverride(dateFormat); return chart; }