DateAxis dateAxis = new DateAxis(timeAxisTitle); DateTickUnit unit = null; unit = new DateTickUnit(DateTickUnit.MINUTE,15); DateFormat chartFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm"); dateAxis.setDateFormatOverride(chartFormatter); dateAxis.setTickUnit(unit); NumberAxis valueAxis = new NumberAxis(valueAxisTitle);
DateAxis axis = new DateAxis("Hour"); SimpleDateFormat format = new SimpleDateFormat("H"); format.setTimeZone(TimeZone.getTimeZone("GMT")); axis.setDateFormatOverride(format);
XYPlot plot = (XYPlot) chart.getPlot(); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("dd-MMM-yyyy"));
DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setAutoRange(true); axis.setDateFormatOverride(new SimpleDateFormat("HH:mm"));
JFreeChart chart; DateAxis axis = (DateAxis)chart.getXYPlot().getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss"));
DateAxis dateAxis = new DateAxis("Time"); dateAxis.setDateFormatOverride(new SimpleDateFormat("HH:mm")); categoryplot.setRangeAxis(dateAxis);
XYPlot plot = chart.getXYPlot(); DateAxis axis = new DateAxis(); plot.setDomainAxis(axis); axis.setDateFormatOverride(new SimpleDateFormat("yyyy"));
DateAxis axis = (DateAxis) plot.getDomainAxis(); DateFormatSymbols dfs = DateFormatSymbols.getInstance(); // default locale String[] roman = { ... }; dfs.setShortMonths(roman); axis.setDateFormatOverride(new SimpleDateFormat("dd-MMM-yyyy", dfs));
XYPlot plot = (XYPlot) chart.getPlot(); DateAxis dateAxis = new DateAxis(); dateAxis.setDateFormatOverride(new SimpleDateFormat("dd-MM-yyyy")); plot.setDomainAxis(dateAxis);
XYPlot plot = chart.getXYPlot(); DateAxis axis = new DateAxis(); plot.setDomainAxis(axis); axis.setDateFormatOverride(new SimpleDateFormat("mm:ss.S"));
private ValueAxis createAxis(int dataType) { ValueAxis axis; if (ProductData.TYPE_UTC == dataType) { axis = new DateAxis("Date", TimeZone.getTimeZone("UTC"), Locale.ENGLISH); ((DateAxis) axis).setDateFormatOverride(SIMPLE_DATE_FORMAT); } else { axis = new NumberAxis(); ((NumberAxis) axis).setAutoRangeIncludesZero(false); } return axis; }
static DateAxis createTimeAxis( String label, SimpleDateFormat dateFormat ) { DateAxis timeAxis = new DateAxis( label ); timeAxis.setDateFormatOverride( dateFormat ); timeAxis.setLowerMargin( MARGIN ); timeAxis.setUpperMargin( MARGIN ); return timeAxis; }
private static ValueAxis createDateAxis() { DateAxis timeAxis = new DateAxis("Timestamp (" + DATE_FORMAT + ")"); SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); timeAxis.setDateFormatOverride(sdf); timeAxis.setLowerMargin(0D); timeAxis.setUpperMargin(0D); timeAxis.setAutoRange(true); timeAxis.setStandardTickUnits(DateAxis.createStandardDateTickUnits()); return defaultAxis(timeAxis); }
private JFreeChart createChart(TimeTableXYDataset chartData) { JFreeChart chart = ChartFactory.createStackedXYAreaChart( "Dogs and Cats", "Time", "Count", chartData, PlotOrientation.VERTICAL, false, true, false); DateAxis dateAxis = new DateAxis(); dateAxis.setDateFormatOverride(new SimpleDateFormat("HH:mm")); dateAxis.setTickLabelFont(dateAxis.getTickLabelFont().deriveFont(20f)); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainAxis(dateAxis); return chart; }
private void setupDateAxis(JFreeChart jchart, Chart chart) { final Plot plot = jchart.getPlot(); final DateAxis axisX = (DateAxis) ((XYPlot)plot).getDomainAxis(); final TimeZone zone = chart.getTimeZone(); if (zone != null) { axisX.setTimeZone(zone); } if (chart.getDateFormat() != null) { axisX.setDateFormatOverride(_dateFormat); } }
public static XYPlot setupXYPlot( JFreeChart chart, DateFormat dateFormat ) { XYPlot plot = chart.getXYPlot(); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride( dateFormat ); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits( NumberAxis.createIntegerTickUnits() ); return plot; }
private JFreeChart createBarChart(String title, String xAxisLabel, String yAxisLabel, XYDataset dataset, boolean legend) { DateAxis xAxis = new DateAxis(xAxisLabel); xAxis.setDateFormatOverride(AXIS_DATE_FORMAT); NumberAxis yAxis = new NumberAxis(yAxisLabel); XYBarRenderer renderer = new XYBarRenderer(); renderer.setShadowVisible(false); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); } }
private JFreeChart createXYLineChart(String title, String xAxisLabel, String yAxisLabel, XYDataset dataset, boolean legend, boolean includeZero) { DateAxis xAxis = new DateAxis(xAxisLabel); xAxis.setDateFormatOverride(AXIS_DATE_FORMAT); NumberAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setAutoRangeIncludesZero(includeZero); XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); }
private void configureTimeAxis(XYPlot plot) { DateAxis timeAxis = (DateAxis) plot.getDomainAxis(); final Date start = getStartTime(getTimespan()); final Date end = getEndTime(getTimespan()); timeAxis.setRange(start, end); final Locale locale = i18n.getLocale(); IoParameters parameters = getParameters(); String timeformat = parameters.getTimeFormat(); DateFormat requestTimeFormat = new SimpleDateFormat(timeformat, locale); final DateTimeZone timezone = getTimezone(); requestTimeFormat.setTimeZone(timezone.toTimeZone()); timeAxis.setDateFormatOverride(requestTimeFormat); timeAxis.setTimeZone(timezone.toTimeZone()); }
private void configureTimeAxis(XYPlot xyPlot) { DateAxis timeAxis = (DateAxis) xyPlot.getDomainAxis(); timeAxis.setRange(getStartTime(getTimespan()), getEndTime(getTimespan())); String timeformat = "yyyy-MM-dd, HH:mm"; if (getChartStyleDefinitions().containsParameter("timeformat")) { timeformat = getChartStyleDefinitions().getAsString("timeformat"); } DateFormat requestTimeFormat = new SimpleDateFormat(timeformat, i18n.getLocale()); requestTimeFormat.setTimeZone(getTimezone().toTimeZone()); timeAxis.setDateFormatOverride(requestTimeFormat); timeAxis.setTimeZone(getTimezone().toTimeZone()); }