Java 类org.jfree.chart.renderer.xy.ClusteredXYBarRenderer 实例源码

项目:HTML5_WebSite    文件:SuperYIntervalChartA.java   
/**
    * Creates a chart.
    * 
    * @param dataset  the dataset.
    * 
    * @return a chart.
    */
   protected JFreeChart createChart(IntervalXYDataset dataset) {
         JFreeChart chart = ChartFactory.createXYBarChart(
           chartTitle,      // chart title
           "Date",                     // domain axis label
           true,
           "Y",                        // range axis label
           dataset,                    // data
           PlotOrientation.VERTICAL,
           !legendPanelOn,                       // include legend
           true,
           false
       );

       // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
       XYPlot plot = chart.getXYPlot();
       plot.setRenderer(new ClusteredXYBarRenderer());
       // OPTIONAL CUSTOMISATION COMPLETED.
       return chart;            
}
项目:HTML5_WebSite    文件:SuperYIntervalChartA.java   
protected JFreeChart createLegend(IntervalXYDataset dataset) {

JFreeChart chart = ChartFactory.createXYBarChart(
           chartTitle,      // chart title
           "Date",                     // domain axis label
           true,
           "Y",                        // range axis label
           dataset,                    // data
           PlotOrientation.VERTICAL,
           true,                       // include legend
           true,
           false
       );

       // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
  XYPlot plot = chart.getXYPlot();
       plot.setRenderer(new ClusteredXYBarRenderer());
       return chart;

   }
项目:HTML5_WebSite    文件:SuperYIntervalChart.java   
/**
    * Creates a chart.
    * 
    * @param dataset  the dataset.
    * 
    * @return a chart.
    */
   protected JFreeChart createChart(IntervalXYDataset dataset) {
         JFreeChart chart = ChartFactory.createXYBarChart(
           chartTitle,      // chart title
           "Date",                     // domain axis label
           true,
           "Y",                        // range axis label
           dataset,                    // data
           PlotOrientation.VERTICAL,
           !legendPanelOn,                       // include legend
           true,
           false
       );

       // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
       XYPlot plot = chart.getXYPlot();
       plot.setRenderer(new ClusteredXYBarRenderer());
       // OPTIONAL CUSTOMISATION COMPLETED.
       return chart;            
}
项目:HTML5_WebSite    文件:SuperYIntervalChart.java   
protected JFreeChart createLegend(IntervalXYDataset dataset) {

JFreeChart chart = ChartFactory.createXYBarChart(
           chartTitle,      // chart title
           "Date",                     // domain axis label
           true,
           "Y",                        // range axis label
           dataset,                    // data
           PlotOrientation.VERTICAL,
           true,                       // include legend
           true,
           false
       );

       // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
  XYPlot plot = chart.getXYPlot();
       plot.setRenderer(new ClusteredXYBarRenderer());
       return chart;

   }
项目:HTML5_WebSite    文件:SuperIntervalXYChart_Time.java   
/**
    * Creates a chart.
    * 
    * @param dataset  the dataset.
    * 
    * @return a chart.
    */
   protected JFreeChart createChart(IntervalXYDataset dataset) {
         JFreeChart chart = ChartFactory.createXYBarChart(
           chartTitle,      // chart title
           domainLabel,                     // domain axis label
           true,
           rangeLabel,                        // range axis label
           dataset,                    // data
           PlotOrientation.VERTICAL,
           !legendPanelOn,                       // include legend
           true,
           false
       );

       // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
       XYPlot plot = chart.getXYPlot();
       plot.setRenderer(new ClusteredXYBarRenderer());
       // OPTIONAL CUSTOMISATION COMPLETED.
       return chart;            
}
项目:parabuild-ci    文件:ClusteredXYBarRendererTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    ClusteredXYBarRenderer r1 = new ClusteredXYBarRenderer();
    ClusteredXYBarRenderer r2 = new ClusteredXYBarRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
项目:parabuild-ci    文件:ClusteredXYBarRendererTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    ClusteredXYBarRenderer r1 = new ClusteredXYBarRenderer();
    ClusteredXYBarRenderer r2 = new ClusteredXYBarRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
项目:Prism-gsoc16    文件:Histogram.java   
/**
 * Initialize all the fields of the Histogram and set some properties
 */
public void init(){

    keyToSeries = new HashMap<SeriesKey, XYIntervalSeries>();
    keyToGraphSeries = new HashMap<SeriesKey, SeriesSettings>();
    chart = this.getChart();
    plot = chart.getXYPlot();
    plot.setBackgroundPaint((Paint)Color.white);

    plot.setDrawingSupplier(new DefaultDrawingSupplier(
            SeriesSettings.DEFAULT_PAINTS,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            SeriesSettings.DEFAULT_SHAPES
            )); 

    seriesCollection = (XYIntervalSeriesCollection)plot.getDataset();
    maxProb = 1.0;
    minProb = 0.0;
    numOfBuckets = 10; // default value, can be altered
    plot.setRenderer(new ClusteredXYBarRenderer());
    addToolTip();
    ticks = new ArrayList<Double>();
    setCustomDomainAxis();

    plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
}
项目:Prism-gsoc16    文件:Histogram.java   
/**
 * Add custom tool tip for the Histogram to show more info
 */
public void addToolTip(){

    ((ClusteredXYBarRenderer)plot.getRenderer()).setBaseToolTipGenerator(new XYToolTipGenerator() {

        @Override
        public String generateToolTip(XYDataset dataset, int seriesIndex, int item) {

            XYIntervalSeriesCollection collection = (XYIntervalSeriesCollection)dataset;
            XYIntervalSeries series = collection.getSeries(seriesIndex);

            double minX = series.getXLowValue(item);
            double maxX = series.getXHighValue(item);
            double height = series.getYValue(item);

            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append(String.format("<html><p style='color:#0000ff;'>Prop: '%s'</p>", dataset.getSeriesKey(seriesIndex)));
            stringBuilder.append("<table style=\"width:100%\">");
            stringBuilder.append("<tr><td> Min range: </td><td>" + (Math.round( minX * 10000.0 ) / 10000.0)  + "</td></tr>");
            stringBuilder.append("<tr><td> Max range: </td><td>" + (Math.round( maxX * 10000.0 ) / 10000.0) +  "</td></tr>");
            stringBuilder.append("<tr><td> Number of states: </td><td>" + height +  "</td></tr></table>");
            stringBuilder.append("</html>");

            return stringBuilder.toString();
        }
    });

}
项目:HTML5_WebSite    文件:HistogramChartDemo.java   
protected  JFreeChart createChart(IntervalXYDataset dataset) {
      JFreeChart chart = ChartFactory.createXYBarChart(
          chartTitle,
          domainLabel,
          false,
          rangeLabel,
          dataset,
          PlotOrientation.VERTICAL,
         // !legendPanelOn,
          false, // no legend
          true,
          false
      );


      // then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
   chart.setBackgroundPaint(Color.white);

      XYPlot plot = chart.getXYPlot();
      plot.setRenderer(new ClusteredXYBarRenderer());
      XYItemRenderer renderer = plot.getRenderer();

      NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
  //    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
      return chart;
  }
项目:HTML5_WebSite    文件:HistogramChartDemo3.java   
protected  JFreeChart createChart(IntervalXYDataset dataset) {
      JFreeChart chart = ChartFactory.createXYBarChart(
          chartTitle,
          domainLabel,
          true,
          rangeLabel,
          dataset,
          PlotOrientation.VERTICAL,
          false,// !legendPanelOn,
          true,
          false
      );

      // then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
  chart.setBackgroundPaint(Color.white);

      XYPlot plot = chart.getXYPlot();
      plot.setRenderer(new ClusteredXYBarRenderer());
XYItemRenderer renderer = plot.getRenderer();

      StandardXYToolTipGenerator generator = new StandardXYToolTipGenerator(
          "{1} = {2}", new SimpleDateFormat("yyyy"), new DecimalFormat("0")
      );
renderer.setBaseToolTipGenerator(generator);
      renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());

      plot.setBackgroundPaint(Color.lightGray);
      plot.setRangeGridlinePaint(Color.white);

      DateAxis axis = (DateAxis) plot.getDomainAxis();
      axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
      axis.setLowerMargin(0.01);
      axis.setUpperMargin(0.01);
//      setXSummary(dataset);  X  is time
      return chart;
  }
项目:HTML5_WebSite    文件:HistogramChartDemo6.java   
protected  JFreeChart createChart(IntervalXYDataset dataset) {
      JFreeChart chart = ChartFactory.createXYBarChart(
          chartTitle,
          domainLabel,
          false,
          rangeLabel,
          dataset,
          PlotOrientation.VERTICAL,
          false, //!legendPanelOn,
          true,
          false
      );


      // then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
   chart.setBackgroundPaint(Color.white);

      XYPlot plot = chart.getXYPlot();
      plot.setRenderer(new ClusteredXYBarRenderer());
      XYItemRenderer renderer = plot.getRenderer();

      NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
      domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());

      return chart;
  }
项目:HTML5_WebSite    文件:HistogramChartDemo5.java   
protected  JFreeChart createChart(IntervalXYDataset dataset) {
 domainLabel= "Row_Number";
 rangeLabel= "Frequency";

      JFreeChart chart = ChartFactory.createXYBarChart(
          chartTitle,
          domainLabel,
          false,
          rangeLabel,
          dataset,
          PlotOrientation.VERTICAL,
          false,//!legendPanelOn,
          true,
          false
      );


      // then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
   chart.setBackgroundPaint(Color.white);

      XYPlot plot = chart.getXYPlot();
      plot.setRenderer(new ClusteredXYBarRenderer());
      XYItemRenderer renderer = plot.getRenderer();

      NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
      domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
      return chart;
  }
项目:HTML5_WebSite    文件:HistogramChartDemo4.java   
protected  JFreeChart createChart(IntervalXYDataset dataset) {
      JFreeChart chart = ChartFactory.createXYBarChart(
          chartTitle,
          domainLabel,
          false,
          rangeLabel,
          dataset,
          PlotOrientation.VERTICAL,
          false,//!legendPanelOn,
          true,
          false
      );


      // then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
   chart.setBackgroundPaint(Color.white);

      XYPlot plot = chart.getXYPlot();
      plot.setRenderer(new ClusteredXYBarRenderer());
      XYItemRenderer renderer = plot.getRenderer();

      NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
      domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
      return chart;
  }
项目:HTML5_WebSite    文件:XYBarChartDemo1.java   
protected  JFreeChart createChart(IntervalXYDataset dataset) {
      JFreeChart chart = ChartFactory.createXYBarChart(
          chartTitle,
          domainLabel,
          true,
          rangeLabel,
          dataset,
          PlotOrientation.VERTICAL,
          !legendPanelOn,
          true,
          false
      );


      // then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
  chart.setBackgroundPaint(Color.white);

      XYPlot plot = chart.getXYPlot();
      plot.setRenderer(new ClusteredXYBarRenderer());
XYItemRenderer renderer = plot.getRenderer();

      StandardXYToolTipGenerator generator = new StandardXYToolTipGenerator(
          "{1} = {2}", new SimpleDateFormat("yyyy"), new DecimalFormat("0")
      );
renderer.setBaseToolTipGenerator(generator);
      renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());

      plot.setBackgroundPaint(Color.lightGray);
      plot.setRangeGridlinePaint(Color.white);

      DateAxis axis = (DateAxis) plot.getDomainAxis();
      axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
      axis.setLowerMargin(0.01);
      axis.setUpperMargin(0.01);
//      setXSummary(dataset);  X  is time
      return chart;
  }
项目:HTML5_WebSite    文件:PowerTransformHistogramChart.java   
protected  JFreeChart createChart(IntervalXYDataset dataset) {
      JFreeChart chart = ChartFactory.createXYBarChart(
          chartTitle,
          domainLabel,
          false,
          rangeLabel,
          dataset,
          PlotOrientation.VERTICAL,
          true,
          true,
          false
      );

      // then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
   chart.setBackgroundPaint(Color.white);

   XYPlot plot = chart.getXYPlot();
   plot.setRenderer(new ClusteredXYBarRenderer());
   //plot.setRenderer(new XYBarRenderer());
      XYItemRenderer renderer = plot.getRenderer();

      NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
  //    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

     // setXSummary(dataset);  //X  is time
      renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
      return chart;
  }
项目:HTML5_WebSite    文件:XYBarChartDemo2.java   
/** 
   * Creates a chart.
   * 
   * @param dataset  the dataset.
   * 
   * @return The chart.
   */
  protected  JFreeChart createChart(IntervalXYDataset dataset) {
      JFreeChart chart = ChartFactory.createXYBarChart(
         chartTitle,      // chart title
          domainLabel,                     // domain axis label
          true,
          rangeLabel,                        // range axis label
          dataset,                    // data
          PlotOrientation.VERTICAL,
          !legendPanelOn,                       // include legend
          //false,   // when choose no legend, the color order used in chart is different 
          true,
          false
      );

      // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
      XYPlot plot = chart.getXYPlot();
      plot.setRenderer(new ClusteredXYBarRenderer());

XYItemRenderer renderer = plot.getRenderer();
      renderer.setBaseToolTipGenerator(
          new StandardXYToolTipGenerator(
              StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
              new SimpleDateFormat("d-MMM-yy"), new DecimalFormat("#,##0.00")
          )
      );
renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
      // OPTIONAL CUSTOMISATION COMPLETED.

//setXSummary(dataset);  X is time
      return chart;        
  }
项目:HTML5_WebSite    文件:XYBarChartDemo2.java   
protected JFreeChart createLegend(IntervalXYDataset dataset) {

       JFreeChart chart = ChartFactory.createXYBarChart(
               chartTitle,      // chart title
               domainLabel,                     // domain axis label
                true,
                rangeLabel,                        // range axis label
                dataset,                    // data
                PlotOrientation.VERTICAL,
                true,                       // include legend
                true,
                false
            );

            // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
            XYPlot plot = chart.getXYPlot();
            plot.setRenderer(new ClusteredXYBarRenderer());

            XYItemRenderer renderer = plot.getRenderer();
            renderer.setBaseToolTipGenerator(
                new StandardXYToolTipGenerator(
                    StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
                    new SimpleDateFormat("d-MMM-yy"), new DecimalFormat("#,##0.00")
                )
            );
            renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
            // OPTIONAL CUSTOMISATION COMPLETED.

            //setXSummary(dataset);  X is time
            return chart;        

}
项目:HTML5_WebSite    文件:HistogramChartDemo2.java   
protected  JFreeChart createChart(IntervalXYDataset dataset) {
      JFreeChart chart = ChartFactory.createXYBarChart(
          chartTitle,
          domainLabel,
          false,
          rangeLabel,
          dataset,
          PlotOrientation.VERTICAL,
          false,// !legendPanelOn,
          true,
          false
      );


      // then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
   chart.setBackgroundPaint(Color.white);

      XYPlot plot = chart.getXYPlot();
      plot.setRenderer(new ClusteredXYBarRenderer());
      XYItemRenderer renderer = plot.getRenderer();

      NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
  //    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

     // setXSummary(dataset);  //X  is time
      renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
      return chart;
  }
项目:HTML5_WebSite    文件:SuperIntervalXYChart.java   
/**
   * Creates a chart.
   * 
   * @param dataset  the dataset.
   * 
   * @return a chart.
   */
protected  JFreeChart createChart(IntervalXYDataset dataset) {
    JFreeChart chart = ChartFactory.createXYBarChart(
        chartTitle,
        domainLabel,
        false,
        rangeLabel,
        dataset,
        PlotOrientation.VERTICAL,
        !legendPanelOn,
        true,
        false
    );


    // then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
   chart.setBackgroundPaint(Color.white);

    XYPlot plot = chart.getXYPlot();
    plot.setRenderer(new ClusteredXYBarRenderer());
    XYItemRenderer renderer = plot.getRenderer();

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
    return chart;
}
项目:HTML5_WebSite    文件:SuperHistogramChart.java   
/**
    * Creates a chart.
    * 
    * @param dataset  the dataset.
    * 
    * @return a chart.
    */
   protected JFreeChart createChart(IntervalXYDataset dataset) {
         JFreeChart chart = ChartFactory.createXYBarChart(
           chartTitle,      // chart title
           domainLabel,                     // domain axis label
           false,
           rangeLabel,                        // range axis label
           dataset,                    // data
           PlotOrientation.VERTICAL,
          // !legendPanelOn,                       // include legend
           false, //no legend
           true,
           false
       );

       // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
       XYPlot plot = chart.getXYPlot();
       plot.setRenderer(new ClusteredXYBarRenderer());

       NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
       rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

       NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
       domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

       XYItemRenderer renderer = plot.getRenderer();
       renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
       // OPTIONAL CUSTOMISATION COMPLETED.
       return chart;            
}
项目:nabs    文件:ClusteredXYBarRendererTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    ClusteredXYBarRenderer r1 = new ClusteredXYBarRenderer();
    ClusteredXYBarRenderer r2 = new ClusteredXYBarRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
项目:astor    文件:ClusteredXYBarRendererTests.java   
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashcode() {
    ClusteredXYBarRenderer r1 = new ClusteredXYBarRenderer();
    ClusteredXYBarRenderer r2 = new ClusteredXYBarRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
项目:twitter-anomalyDetection-java    文件:StlPlotter.java   
private JFreeChart createChart() {

      final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time"));
      final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);
      final ClusteredXYBarRenderer barRenderer = new ClusteredXYBarRenderer();
      final GradientPaint black = new GradientPaint(0.0f, 0.0f, Color.black, 0.0f, 0.0f, Color.black);

      final TimeSeries seriests = new TimeSeries("Series");
      final TimeSeries seasonalts = new TimeSeries("Seasonal");
      final TimeSeries trendts = new TimeSeries("Trend");
      final TimeSeries remainderts = new TimeSeries("Remainder");

      final TimeSeries[] tsArray = new TimeSeries[]{seriests, seasonalts, trendts};
      final String[] labels = new String[]{"Series", "Seasonal", "Trend"};

      for (int i = 0; i < series.length; i++) {
        final Date d = new Date((long) times[i]);
        RegularTimePeriod rtp = RegularTimePeriod.createInstance(this.timePeriod, d, TimeZone.getDefault());
        seriests.addOrUpdate(rtp, series[i]);
        seasonalts.addOrUpdate(rtp, seasonal[i]);
        trendts.addOrUpdate(rtp, trend[i]);
        remainderts.addOrUpdate(rtp, remainder[i]);
      }

      plot.setGap(10.0);
      renderer.setSeriesPaint(0, black);
      barRenderer.setSeriesPaint(0, black);
      plot.setOrientation(PlotOrientation.VERTICAL);

      for (int i = 0; i < tsArray.length; i++) {
        final XYDataset ts = new TimeSeriesCollection(tsArray[i]);
        final XYPlot p = new XYPlot(ts, new DateAxis(labels[i]), new NumberAxis(labels[i]), renderer);
        plot.add(p);
      }

      final XYDataset rts = new TimeSeriesCollection(remainderts);
      final XYDataset sts = new TimeSeriesCollection(seriests);
      final XYDataset tts = new TimeSeriesCollection(trendts);
      final XYPlot rplot = new XYPlot(rts, new DateAxis(), new NumberAxis("Remainder"), barRenderer);
      final XYPlot seriesAndTrend = new XYPlot(sts, new DateAxis(), new NumberAxis("S & T"), renderer);

      seriesAndTrend.setDataset(1, tts);
      seriesAndTrend.setRenderer(1, renderer);

      plot.add(rplot);
      plot.add(seriesAndTrend);

      return new JFreeChart(this.title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    }
项目:parabuild-ci    文件:ClusteredXYBarRendererTests.java   
/**
 * Problem that the equals(...) method distinguishes all fields.
 */
public void testEquals() {
    ClusteredXYBarRenderer r1 = new ClusteredXYBarRenderer();
    ClusteredXYBarRenderer r2 = new ClusteredXYBarRenderer();
    assertEquals(r1, r2);
}
项目:stl-java    文件:StlPlotter.java   
private JFreeChart createChart() {

      final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time"));
      final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);
      final ClusteredXYBarRenderer barRenderer = new ClusteredXYBarRenderer();
      final GradientPaint black = new GradientPaint(0.0f, 0.0f, Color.black, 0.0f, 0.0f, Color.black);

      final TimeSeries seriests = new TimeSeries("Series");
      final TimeSeries seasonalts = new TimeSeries("Seasonal");
      final TimeSeries trendts = new TimeSeries("Trend");
      final TimeSeries remainderts = new TimeSeries("Remainder");

      final TimeSeries[] tsArray = new TimeSeries[]{seriests, seasonalts, trendts};
      final String[] labels = new String[]{"Series", "Seasonal", "Trend"};

      for (int i = 0; i < series.length; i++) {
        final Date d = new Date((long) times[i]);
        RegularTimePeriod rtp = RegularTimePeriod.createInstance(this.timePeriod, d, TimeZone.getDefault());
        seriests.addOrUpdate(rtp, series[i]);
        seasonalts.addOrUpdate(rtp, seasonal[i]);
        trendts.addOrUpdate(rtp, trend[i]);
        remainderts.addOrUpdate(rtp, remainder[i]);
      }

      plot.setGap(10.0);
      renderer.setSeriesPaint(0, black);
      barRenderer.setSeriesPaint(0, black);
      plot.setOrientation(PlotOrientation.VERTICAL);

      for (int i = 0; i < tsArray.length; i++) {
        final XYDataset ts = new TimeSeriesCollection(tsArray[i]);
        final XYPlot p = new XYPlot(ts, new DateAxis(labels[i]), new NumberAxis(labels[i]), renderer);
        plot.add(p);
      }

      final XYDataset rts = new TimeSeriesCollection(remainderts);
      final XYDataset sts = new TimeSeriesCollection(seriests);
      final XYDataset tts = new TimeSeriesCollection(trendts);
      final XYPlot rplot = new XYPlot(rts, new DateAxis(), new NumberAxis("Remainder"), barRenderer);
      final XYPlot seriesAndTrend = new XYPlot(sts, new DateAxis(), new NumberAxis("S & T"), renderer);

      seriesAndTrend.setDataset(1, tts);
      seriesAndTrend.setRenderer(1, renderer);

      plot.add(rplot);
      plot.add(seriesAndTrend);

      return new JFreeChart(this.title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    }
项目:mzmine2    文件:HistogramChart.java   
public HistogramChart() {

    super(null, true);

    // initialize the chart by default time series chart from factory
    chart = ChartFactory.createHistogram("", // title
        "", // x-axis label
        "", // y-axis label
        null, // data set
        PlotOrientation.VERTICAL, // orientation
        true, // create legend
        false, // generate tooltips
        false // generate URLs
        );

    // title
    chartTitle = chart.getTitle();
    chartTitle.setFont(titleFont);
    chartTitle.setMargin(5, 0, 0, 0);

    chartSubTitle = new TextTitle();
    chartSubTitle.setFont(subTitleFont);
    chartSubTitle.setMargin(5, 0, 0, 0);
    chart.addSubtitle(chartSubTitle);

    // legend constructed by ChartFactory
    LegendTitle legend = chart.getLegend();
    legend.setItemFont(legendFont);
    legend.setFrame(BlockBorder.NONE);

    chart.setBackgroundPaint(Color.white);
    setChart(chart);

    // disable maximum size (we don't want scaling)
    setMaximumDrawWidth(Integer.MAX_VALUE);
    setMaximumDrawHeight(Integer.MAX_VALUE);

    // set the plot properties
    plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE);
    plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD);

    // set grid properties
    plot.setDomainGridlinePaint(gridColor);
    plot.setRangeGridlinePaint(gridColor);

    // set crosshair (selection) properties
    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairVisible(true);

    // set the logarithmic axis
    NumberAxis axisDomain = new HistogramDomainAxis();
    axisDomain.setMinorTickCount(1);
    axisDomain.setAutoRange(true);

    NumberAxis axisRange = new NumberAxis();
    axisRange.setMinorTickCount(1);
    axisRange.setAutoRange(true);

    plot.setDomainAxis(axisDomain);
    plot.setRangeAxis(axisRange);

    ClusteredXYBarRenderer renderer = new ClusteredXYBarRenderer();
    renderer.setMargin(marginSize);
    renderer.setShadowVisible(false);
    plot.setRenderer(renderer);

    this.setMinimumSize(new Dimension(400, 400));
    this.setDismissDelay(Integer.MAX_VALUE);
    this.setInitialDelay(0);

    }
项目:kevoree-brain    文件:StlPlotter.java   
private JFreeChart createChart() {

            final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time"));
            final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);
            final ClusteredXYBarRenderer barRenderer = new ClusteredXYBarRenderer();
            final GradientPaint black = new GradientPaint(0.0f, 0.0f, Color.black, 0.0f, 0.0f, Color.black);

            final TimeSeries seriests = new TimeSeries("Series");
            final TimeSeries seasonalts = new TimeSeries("Seasonal");
            final TimeSeries trendts = new TimeSeries("Trend");
            final TimeSeries remainderts = new TimeSeries("Remainder");

            final TimeSeries[] tsArray = new TimeSeries[]{seriests, seasonalts, trendts};
            final String[] labels = new String[]{"Series", "Seasonal", "Trend"};

            for (int i = 0; i < series.length; i++) {
                final Date d = new Date((long) times[i]);
                RegularTimePeriod rtp = RegularTimePeriod.createInstance(this.timePeriod, d, TimeZone.getDefault());
                seriests.addOrUpdate(rtp, series[i]);
                seasonalts.addOrUpdate(rtp, seasonal[i]);
                trendts.addOrUpdate(rtp, trend[i]);
                remainderts.addOrUpdate(rtp, remainder[i]);
            }

            plot.setGap(10.0);
            renderer.setSeriesPaint(0, black);
            barRenderer.setSeriesPaint(0, black);
            plot.setOrientation(PlotOrientation.VERTICAL);

            for (int i = 0; i < tsArray.length; i++) {
                final XYDataset ts = new TimeSeriesCollection(tsArray[i]);
                final XYPlot p = new XYPlot(ts, new DateAxis(labels[i]), new NumberAxis(labels[i]), renderer);
                plot.add(p);
            }

            final XYDataset rts = new TimeSeriesCollection(remainderts);
            final XYDataset sts = new TimeSeriesCollection(seriests);
            final XYDataset tts = new TimeSeriesCollection(trendts);
            final XYPlot rplot = new XYPlot(rts, new DateAxis(), new NumberAxis("Remainder"), barRenderer);
            final XYPlot seriesAndTrend = new XYPlot(sts, new DateAxis(), new NumberAxis("S & T"), renderer);

            seriesAndTrend.setDataset(1, tts);
            seriesAndTrend.setRenderer(1, renderer);

            plot.add(rplot);
            plot.add(seriesAndTrend);

            return new JFreeChart(this.title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
        }
项目:astor    文件:ClusteredXYBarRendererTests.java   
/**
 * Verify that this class implements {@link PublicCloneable}.
 */
public void testPublicCloneable() {
    ClusteredXYBarRenderer r1 = new ClusteredXYBarRenderer();
    assertTrue(r1 instanceof PublicCloneable);
}