/** * Returns a collection of standard date tick units that uses the default * time zone. This collection will be used by default, but you are free * to create your own collection if you want to (see the * {@link ValueAxis#setStandardTickUnits(TickUnitSource)} method inherited * from the {@link ValueAxis} class). * * @return A collection of standard date tick units. */ public static TickUnitSource createStandardDateTickUnits() { return createStandardDateTickUnits(TimeZone.getDefault(), Locale.getDefault()); }
/** * Returns a collection of standard date tick units that uses the default * time zone. This collection will be used by default, but you are free * to create your own collection if you want to (see the * {@link ValueAxis#setStandardTickUnits(TickUnitSource)} method inherited * from the {@link ValueAxis} class). * * @return A collection of standard date tick units. */ public static TickUnitSource createStandardDateTickUnits() { return createStandardDateTickUnits(TimeZone.getDefault(), Locale.getDefault()); }
/** * Returns a collection of standard date tick units. This collection will * be used by default, but you are free to create your own collection if * you want to (see the * {@link ValueAxis#setStandardTickUnits(TickUnitSource)} method inherited * from the {@link ValueAxis} class). * * @param zone the time zone (<code>null</code> not permitted). * * @return A collection of standard date tick units. * * @deprecated Since 1.0.11, use {@link #createStandardDateTickUnits( * TimeZone, Locale)} to explicitly set the locale as well as the * time zone. */ public static TickUnitSource createStandardDateTickUnits(TimeZone zone) { return createStandardDateTickUnits(zone, Locale.getDefault()); }
/** * Creates a date axis. * * @param label the axis label ({@code null} permitted). * @param zone the time zone. * @param locale the locale ({@code null} not permitted). * * @since 1.0.11 */ public DateAxis(String label, TimeZone zone, Locale locale) { super(label, DateAxis.createStandardDateTickUnits(zone, locale)); this.tickUnit = new DateTickUnit(DateTickUnitType.DAY, 1, new SimpleDateFormat()); setAutoRangeMinimumSize( DEFAULT_AUTO_RANGE_MINIMUM_SIZE_IN_MILLISECONDS); setRange(DEFAULT_DATE_RANGE, false, false); this.dateFormatOverride = null; this.timeZone = zone; this.locale = locale; this.timeline = DEFAULT_TIMELINE; }
/** * Sets the time zone for the axis and sends an {@link AxisChangeEvent} to * all registered listeners. * * @param zone the time zone (<code>null</code> not permitted). * * @since 1.0.4 * * @see #getTimeZone() */ public void setTimeZone(TimeZone zone) { if (zone == null) { throw new IllegalArgumentException("Null 'zone' argument."); } if (!this.timeZone.equals(zone)) { this.timeZone = zone; setStandardTickUnits(createStandardDateTickUnits(zone, this.locale)); notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets the locale for the axis and sends a change event to all registered * listeners. * * @param locale the new locale ({@code null} not permitted). */ public void setLocale(Locale locale) { Args.nullNotPermitted(locale, "locale"); this.locale = locale; setStandardTickUnits(createStandardDateTickUnits(this.timeZone, this.locale)); fireChangeEvent(); }
/** * Sets the time zone for the axis and sends an {@link AxisChangeEvent} to * all registered listeners. * * @param zone the time zone ({@code null} not permitted). * * @since 1.0.4 * * @see #getTimeZone() */ public void setTimeZone(TimeZone zone) { Args.nullNotPermitted(zone, "zone"); this.timeZone = zone; setStandardTickUnits(createStandardDateTickUnits(zone, this.locale)); fireChangeEvent(); }
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); }
/** * Creates a date axis. A timeline is specified for the axis. This allows * special transformations to occur between a domain of values and the * values included in the axis. * * @see org.jfree.chart.axis.SegmentedTimeline * * @param label the axis label (<code>null</code> permitted). * @param zone the time zone. * @param locale the locale (<code>null</code> not permitted). * * @since 1.0.11 */ public DateAxis(String label, TimeZone zone, Locale locale) { super(label, DateAxis.createStandardDateTickUnits(zone, locale)); setTickUnit(DateAxis.DEFAULT_DATE_TICK_UNIT, false, false); setAutoRangeMinimumSize( DEFAULT_AUTO_RANGE_MINIMUM_SIZE_IN_MILLISECONDS); setRange(DEFAULT_DATE_RANGE, false, false); this.dateFormatOverride = null; this.timeZone = zone; this.locale = locale; this.timeline = DEFAULT_TIMELINE; }