/** * Applies the attributes for this theme to a {@link PeriodAxis}. * * @param axis the axis ({@code null} not permitted). */ protected void applyToPeriodAxis(PeriodAxis axis) { PeriodAxisLabelInfo[] info = axis.getLabelInfo(); for (int i = 0; i < info.length; i++) { PeriodAxisLabelInfo e = info[i]; PeriodAxisLabelInfo n = new PeriodAxisLabelInfo(e.getPeriodClass(), e.getDateFormat(), e.getPadding(), this.regularFont, this.tickLabelPaint, e.getDrawDividers(), e.getDividerStroke(), e.getDividerPaint()); info[i] = n; } axis.setLabelInfo(info); }
/** * Creates a time period that includes the specified millisecond, assuming * the given time zone. * * @param millisecond the time. * @param zone the time zone. * * @return The time period. * * @deprecated As of 1.0.13, use the method that specifies the locale also. */ public RegularTimePeriod createInstance(Date millisecond, TimeZone zone) { return createInstance(millisecond, zone, Locale.getDefault()); }
FontMetrics fm = g2.getFontMetrics(this.labelInfo[band].getLabelFont()); if (edge == RectangleEdge.BOTTOM) { delta1 = this.labelInfo[band].getPadding().calculateTopOutset( fm.getHeight()); delta1 = this.labelInfo[band].getPadding().calculateBottomOutset( fm.getHeight()); long axisMin = this.first.getFirstMillisecond(); long axisMax = this.last.getLastMillisecond(); g2.setFont(this.labelInfo[band].getLabelFont()); g2.setPaint(this.labelInfo[band].getLabelPaint()); RegularTimePeriod p1 = this.labelInfo[band].createInstance( new Date(axisMin), this.timeZone, this.locale); RegularTimePeriod p2 = this.labelInfo[band].createInstance( new Date(axisMax), this.timeZone, this.locale); DateFormat df = this.labelInfo[band].getDateFormat(); df.setTimeZone(this.timeZone); String label1 = df.format(new Date(p1.getMiddleMillisecond())); RegularTimePeriod p = this.labelInfo[band].createInstance( new Date(axisMin), this.timeZone, this.locale); Rectangle2D b = null; g2.setPaint(this.labelInfo[band].getLabelPaint()); b = TextUtils.drawAlignedString(label, g2, x, y, anchor); if (this.labelInfo[band].getDrawDividers()) {
... SimpleDateFormat dfMin = new SimpleDateFormat("mm"); dfMin.setTimeZone(tz); // Setting timezone PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[2]; aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo( org.jfree.data.time.Minute.class, dfMin); SimpleDateFormat dfHour = new SimpleDateFormat("mm"); dfHour.setTimeZone(tz); // Setting timezone aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo( org.jfree.data.time.Hour.class, dfHour); periodaxis.setLabelInfo(aperiodaxislabelinfo); ...
FontMetrics fm = g2.getFontMetrics(info.getLabelFont()); tickLabelBandsDimension += info.getPadding().extendHeight(fm.getHeight());
FontMetrics fm = g2.getFontMetrics(this.labelInfo[band].getLabelFont()); if (edge == RectangleEdge.BOTTOM) { delta1 = this.labelInfo[band].getPadding().calculateTopOutset( fm.getHeight()); delta1 = this.labelInfo[band].getPadding().calculateBottomOutset( fm.getHeight()); long axisMin = this.first.getFirstMillisecond(); long axisMax = this.last.getLastMillisecond(); g2.setFont(this.labelInfo[band].getLabelFont()); g2.setPaint(this.labelInfo[band].getLabelPaint()); RegularTimePeriod p1 = this.labelInfo[band].createInstance( new Date(axisMin), this.timeZone, this.locale); RegularTimePeriod p2 = this.labelInfo[band].createInstance( new Date(axisMax), this.timeZone, this.locale); String label1 = this.labelInfo[band].getDateFormat().format( new Date(p1.getMiddleMillisecond())); String label2 = this.labelInfo[band].getDateFormat().format( new Date(p2.getMiddleMillisecond())); Rectangle2D b1 = TextUtilities.getTextBounds(label1, g2, RegularTimePeriod p = this.labelInfo[band].createInstance( new Date(axisMin), this.timeZone, this.locale); Rectangle2D b = null; float x = (float) valueToJava2D(p.getMiddleMillisecond(), dataArea, edge);
setAutoRange(true); this.labelInfo = new PeriodAxisLabelInfo[2]; this.labelInfo[0] = new PeriodAxisLabelInfo(Month.class, new SimpleDateFormat("MMM", locale)); this.labelInfo[1] = new PeriodAxisLabelInfo(Year.class, new SimpleDateFormat("yyyy", locale));
FontMetrics fm = g2.getFontMetrics(info.getLabelFont()); tickLabelBandsDimension += info.getPadding().extendHeight(fm.getHeight());
/** * Applies the attributes for this theme to a {@link PeriodAxis}. * * @param axis the axis (<code>null</code> not permitted). */ protected void applyToPeriodAxis(PeriodAxis axis) { PeriodAxisLabelInfo[] info = axis.getLabelInfo(); for (int i = 0; i < info.length; i++) { PeriodAxisLabelInfo e = info[i]; PeriodAxisLabelInfo n = new PeriodAxisLabelInfo(e.getPeriodClass(), e.getDateFormat(), e.getPadding(), this.regularFont, this.tickLabelPaint, e.getDrawDividers(), e.getDividerStroke(), e.getDividerPaint()); info[i] = n; } axis.setLabelInfo(info); }
SimpleDateFormat df0 = new SimpleDateFormat("MMM", locale); df0.setTimeZone(timeZone); this.labelInfo[0] = new PeriodAxisLabelInfo(Month.class, df0); SimpleDateFormat df1 = new SimpleDateFormat("yyyy", locale); df1.setTimeZone(timeZone); this.labelInfo[1] = new PeriodAxisLabelInfo(Year.class, df1);
if(StatsManager.CHARTTIMESERIES_WEEKDAY.equals(timePeriod)) { aperiodaxislabelinfo = new PeriodAxisLabelInfo[2]; aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("E", locale)); aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("d", locale)); }else if(StatsManager.CHARTTIMESERIES_DAY.equals(timePeriod)) { aperiodaxislabelinfo = new PeriodAxisLabelInfo[3]; aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("d", locale)); aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Month.class, new SimpleDateFormat("MMM", locale)); aperiodaxislabelinfo[2] = new PeriodAxisLabelInfo(org.jfree.data.time.Year.class, new SimpleDateFormat("yyyy", locale)); }else if(StatsManager.CHARTTIMESERIES_MONTH.equals(timePeriod)) { aperiodaxislabelinfo = new PeriodAxisLabelInfo[2]; aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Month.class, new SimpleDateFormat("MMM", locale)); aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Year.class, new SimpleDateFormat("yyyy", locale)); }else if(StatsManager.CHARTTIMESERIES_YEAR.equals(timePeriod)) { aperiodaxislabelinfo = new PeriodAxisLabelInfo[1]; aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Year.class, new SimpleDateFormat("yyyy", locale));
switch(ofxTp) case Hour: info[i] = new PeriodAxisLabelInfo(Hour.class,sdf);break; case Day: info[i] = new PeriodAxisLabelInfo(Day.class,sdf);break; case Month: info[i] = new PeriodAxisLabelInfo(Month.class,sdf);break; case Year: info[i] = new PeriodAxisLabelInfo(Year.class,sdf);break;