Esempio n. 1
0
 /**
  * Returns a clone of the axis.
  *
  * @return A clone.
  * @throws CloneNotSupportedException this class is cloneable, but subclasses may not be.
  */
 public Object clone() throws CloneNotSupportedException {
   PeriodAxis clone = (PeriodAxis) super.clone();
   clone.timeZone = (TimeZone) this.timeZone.clone();
   clone.labelInfo = new PeriodAxisLabelInfo[this.labelInfo.length];
   for (int i = 0; i < this.labelInfo.length; i++) {
     clone.labelInfo[i] = this.labelInfo[i]; // copy across references
     // to immutable objs
   }
   return clone;
 }
 /**
  * Tests the axis for equality with an arbitrary object.
  *
  * @param obj the object (<code>null</code> permitted).
  * @return A boolean.
  */
 @Override
 public boolean equals(Object obj) {
   if (obj == this) {
     return true;
   }
   if (!(obj instanceof PeriodAxis)) {
     return false;
   }
   PeriodAxis that = (PeriodAxis) obj;
   if (!this.first.equals(that.first)) {
     return false;
   }
   if (!this.last.equals(that.last)) {
     return false;
   }
   if (!this.timeZone.equals(that.timeZone)) {
     return false;
   }
   if (!this.locale.equals(that.locale)) {
     return false;
   }
   if (!this.autoRangeTimePeriodClass.equals(that.autoRangeTimePeriodClass)) {
     return false;
   }
   if (!(isMinorTickMarksVisible() == that.isMinorTickMarksVisible())) {
     return false;
   }
   if (!this.majorTickTimePeriodClass.equals(that.majorTickTimePeriodClass)) {
     return false;
   }
   if (!this.minorTickTimePeriodClass.equals(that.minorTickTimePeriodClass)) {
     return false;
   }
   if (!this.minorTickMarkPaint.equals(that.minorTickMarkPaint)) {
     return false;
   }
   if (!this.minorTickMarkStroke.equals(that.minorTickMarkStroke)) {
     return false;
   }
   if (!Arrays.equals(this.labelInfo, that.labelInfo)) {
     return false;
   }
   return super.equals(obj);
 }
Esempio n. 3
0
 private static JFreeChart createChart(XYDataset xydataset) {
   JFreeChart jfreechart =
       ChartFactory.createTimeSeriesChart(
           "Legal & General Unit Trust Prices",
           "Date",
           "Price Per Unit",
           xydataset,
           true,
           true,
           false);
   XYPlot xyplot = (XYPlot) jfreechart.getPlot();
   xyplot.setDomainCrosshairVisible(true);
   xyplot.setRangeCrosshairVisible(true);
   org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer();
   if (xyitemrenderer instanceof XYLineAndShapeRenderer) {
     XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer;
     xylineandshaperenderer.setBaseShapesVisible(true);
     xylineandshaperenderer.setBaseShapesFilled(true);
     xylineandshaperenderer.setBaseItemLabelsVisible(true);
   }
   PeriodAxis periodaxis = new PeriodAxis("Date");
   periodaxis.setTimeZone(TimeZone.getTimeZone("Pacific/Auckland"));
   periodaxis.setAutoRangeTimePeriodClass(org.jfree.data.time.Day.class);
   PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[3];
   aperiodaxislabelinfo[0] =
       new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("d"));
   aperiodaxislabelinfo[1] =
       new PeriodAxisLabelInfo(
           org.jfree.data.time.Month.class,
           new SimpleDateFormat("MMM"),
           new RectangleInsets(2D, 2D, 2D, 2D),
           new Font("SansSerif", 1, 10),
           Color.blue,
           false,
           new BasicStroke(0.0F),
           Color.lightGray);
   aperiodaxislabelinfo[2] =
       new PeriodAxisLabelInfo(org.jfree.data.time.Year.class, new SimpleDateFormat("yyyy"));
   periodaxis.setLabelInfo(aperiodaxislabelinfo);
   xyplot.setDomainAxis(periodaxis);
   ChartUtilities.applyCurrentTheme(jfreechart);
   return jfreechart;
 }
 private static JFreeChart createChart(IntervalXYDataset paramIntervalXYDataset) {
   JFreeChart localJFreeChart =
       ChartFactory.createXYBarChart(
           "Maximum Temperature",
           "Day",
           true,
           "Temperature",
           paramIntervalXYDataset,
           PlotOrientation.VERTICAL,
           true,
           true,
           false);
   XYPlot localXYPlot = (XYPlot) localJFreeChart.getPlot();
   localXYPlot.setDomainCrosshairVisible(true);
   localXYPlot.setRangeCrosshairVisible(true);
   PeriodAxis localPeriodAxis = new PeriodAxis("Day");
   localPeriodAxis.setAutoRangeTimePeriodClass(Day.class);
   PeriodAxisLabelInfo[] arrayOfPeriodAxisLabelInfo = new PeriodAxisLabelInfo[3];
   arrayOfPeriodAxisLabelInfo[0] = new PeriodAxisLabelInfo(Day.class, new SimpleDateFormat("d"));
   arrayOfPeriodAxisLabelInfo[1] =
       new PeriodAxisLabelInfo(
           Day.class,
           new SimpleDateFormat("E"),
           new RectangleInsets(2.0D, 2.0D, 2.0D, 2.0D),
           new Font("SansSerif", 1, 10),
           Color.blue,
           false,
           new BasicStroke(0.0F),
           Color.lightGray);
   arrayOfPeriodAxisLabelInfo[2] =
       new PeriodAxisLabelInfo(Month.class, new SimpleDateFormat("MMM"));
   localPeriodAxis.setLabelInfo(arrayOfPeriodAxisLabelInfo);
   localXYPlot.setDomainAxis(localPeriodAxis);
   ChartUtilities.applyCurrentTheme(localJFreeChart);
   return localJFreeChart;
 }