Java 类org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer 实例源码

项目:parabuild-ci    文件:StatisticalLineAndShapeRendererTests.java   
/**
 * Draws the chart with a <code>null</code> info object to make sure that 
 * no exceptions are thrown (particularly by code in the renderer).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        DefaultStatisticalCategoryDataset dataset 
            = new DefaultStatisticalCategoryDataset();
        dataset.add(1.0, 2.0, "S1", "C1");
        dataset.add(3.0, 4.0, "S1", "C2");
        CategoryPlot plot = new CategoryPlot(dataset, 
                new CategoryAxis("Category"), new NumberAxis("Value"), 
                new StatisticalLineAndShapeRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200, 
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
项目:HTML5_WebSite    文件:StatisticalLineChartDemo2.java   
protected JFreeChart createLegend(CategoryDataset dataset) {

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

       // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
       chart.setBackgroundPaint(Color.white);
       CategoryPlot plot = chart.getCategoryPlot();

       StatisticalLineAndShapeRenderer renderer 
          = new StatisticalLineAndShapeRenderer(true, false);
renderer.setLegendItemLabelGenerator(new SOCRCategoryCellLabelGenerator(dataset, values_storage, SERIES_COUNT, CATEGORY_COUNT));
      plot.setRenderer(renderer);
       return chart;

   }
项目:HTML5_WebSite    文件:StatisticalLineChartDemo1.java   
protected JFreeChart createLegend(CategoryDataset dataset) {

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

       // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
       chart.setBackgroundPaint(Color.white);
       CategoryPlot plot = chart.getCategoryPlot();

       StatisticalLineAndShapeRenderer renderer 
          = new StatisticalLineAndShapeRenderer(true, false);
      plot.setRenderer(renderer);


       return chart;

  }
项目:HTML5_WebSite    文件:StatisticalLineChartDemo3.java   
protected JFreeChart createLegend(CategoryDataset dataset) {

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

       // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
       chart.setBackgroundPaint(Color.white);
       CategoryPlot plot = chart.getCategoryPlot();

       StatisticalLineAndShapeRenderer renderer 
          = new StatisticalLineAndShapeRenderer(true, false);
renderer.setLegendItemLabelGenerator(new SOCRCategoryCellLabelGenerator(dataset, values_storage, SERIES_COUNT, CATEGORY_COUNT));
      plot.setRenderer(renderer);
       return chart;

   }
项目:HTML5_WebSite    文件:StatisticalLineChartDemo1a.java   
protected JFreeChart createLegend(CategoryDataset dataset) {

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

       // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
       chart.setBackgroundPaint(Color.white);
       CategoryPlot plot = chart.getCategoryPlot();

       StatisticalLineAndShapeRenderer renderer 
          = new StatisticalLineAndShapeRenderer(true, false);
      plot.setRenderer(renderer);


       return chart;

  }
项目:nabs    文件:StatisticalLineAndShapeRendererTests.java   
/**
 * Draws the chart with a <code>null</code> info object to make sure that 
 * no exceptions are thrown (particularly by code in the renderer).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        DefaultStatisticalCategoryDataset dataset 
            = new DefaultStatisticalCategoryDataset();
        dataset.add(1.0, 2.0, "S1", "C1");
        dataset.add(3.0, 4.0, "S1", "C2");
        CategoryPlot plot = new CategoryPlot(dataset, 
                new CategoryAxis("Category"), new NumberAxis("Value"), 
                new StatisticalLineAndShapeRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200, 
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
项目:astor    文件:StatisticalLineAndShapeRendererTests.java   
/**
 * Draws the chart with a <code>null</code> info object to make sure that
 * no exceptions are thrown (particularly by code in the renderer).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        DefaultStatisticalCategoryDataset dataset
            = new DefaultStatisticalCategoryDataset();
        dataset.add(1.0, 2.0, "S1", "C1");
        dataset.add(3.0, 4.0, "S1", "C2");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new StatisticalLineAndShapeRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
项目:parabuild-ci    文件:StatisticalLineAndShapeRendererTests.java   
/**
 * Check that the equals() method distinguishes all fields.
 */
public void testEquals() {
    StatisticalLineAndShapeRenderer r1 
        = new StatisticalLineAndShapeRenderer();
    StatisticalLineAndShapeRenderer r2 
        = new StatisticalLineAndShapeRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));

    r1.setErrorIndicatorPaint(Color.red);
    assertFalse(r1.equals(r2));
    r2.setErrorIndicatorPaint(Color.red);
    assertTrue(r2.equals(r1));
}
项目:parabuild-ci    文件:StatisticalLineAndShapeRendererTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    StatisticalLineAndShapeRenderer r1 
        = new StatisticalLineAndShapeRenderer();
    StatisticalLineAndShapeRenderer r2 
        = new StatisticalLineAndShapeRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
项目:HTML5_WebSite    文件:StatisticalLineChartDemo2.java   
/**
   * Creates a sample chart.
   * 
   * @param dataset  a dataset.
   * 
   * @return The chart.
   */
  protected JFreeChart createChart(CategoryDataset dataset) {

      // create the chart...
      JFreeChart chart = ChartFactory.createLineChart(
          chartTitle,       // chart title
          domainLabel,                    // domain axis label
          rangeLabel,                   // range axis label
          dataset,                   // data
          PlotOrientation.VERTICAL,  // orientation
          !legendPanelOn,                      // include legend
          true,                      // tooltips
          false                      // urls
      );

      // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
      chart.setBackgroundPaint(Color.white);

      CategoryPlot plot = (CategoryPlot) chart.getPlot();
      plot.setBackgroundPaint(Color.lightGray);
      plot.setRangeGridlinePaint(Color.white);

      CategoryAxis domainAxis = plot.getDomainAxis();
      domainAxis.setUpperMargin(0.0);
      domainAxis.setLowerMargin(0.0);

      // customise the range axis...
      NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
      rangeAxis.setAutoRangeIncludesZero(true);

      // customise the renderer...
      StatisticalLineAndShapeRenderer renderer 
          = new StatisticalLineAndShapeRenderer(true, false);
renderer.setLegendItemLabelGenerator(new SOCRCategoryCellLabelGenerator(dataset, values_storage, SERIES_COUNT, CATEGORY_COUNT));
      plot.setRenderer(renderer);

      // OPTIONAL CUSTOMISATION COMPLETED.
     return chart;
  }
项目:HTML5_WebSite    文件:StatisticalLineChartDemo1.java   
/**
 * Creates a sample chart.
 * 
 * @param dataset  a dataset.
 * 
 * @return The chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {

    // create the chart...
    JFreeChart chart = ChartFactory.createLineChart(
        chartTitle,       // chart title
        domainLabel,                    // domain axis label
        rangeLabel,                   // range axis label
        dataset,                   // data
        PlotOrientation.VERTICAL,  // orientation
        !legendPanelOn,                      // include legend
        true,                      // tooltips
        false                      // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);

    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.white);

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setUpperMargin(0.0);
    domainAxis.setLowerMargin(0.0);

    // customise the range axis...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setAutoRangeIncludesZero(true);

    // customise the renderer...
    StatisticalLineAndShapeRenderer renderer 
        = new StatisticalLineAndShapeRenderer(true, false);
    plot.setRenderer(renderer);

    // OPTIONAL CUSTOMISATION COMPLETED.
   return chart;
}
项目:HTML5_WebSite    文件:StatisticalLineChartDemo3.java   
/**
   * Creates a sample chart.
   * 
   * @param dataset  a dataset.
   * 
   * @return The chart.
   */
protected JFreeChart createChart(CategoryDataset dataset) {

      // create the chart...
      JFreeChart chart = ChartFactory.createLineChart(
          chartTitle,       // chart title
          domainLabel,                    // domain axis label
          rangeLabel,                   // range axis label
          dataset,                   // data
          PlotOrientation.VERTICAL,  // orientation
          !legendPanelOn,                      // include legend
          true,                      // tooltips
          false                      // urls
      );

      // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
      chart.setBackgroundPaint(Color.white);

      CategoryPlot plot = (CategoryPlot) chart.getPlot();
      plot.setBackgroundPaint(Color.lightGray);
      plot.setRangeGridlinePaint(Color.white);

      CategoryAxis domainAxis = plot.getDomainAxis();
      domainAxis.setUpperMargin(0.0);
      domainAxis.setLowerMargin(0.0);

      // customise the range axis...
      NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
      rangeAxis.setAutoRangeIncludesZero(true);

      // customise the renderer...
      StatisticalLineAndShapeRenderer renderer 
          = new StatisticalLineAndShapeRenderer(true, false);
renderer.setLegendItemLabelGenerator(new SOCRCategoryCellLabelGenerator(dataset, values_storage, SERIES_COUNT, CATEGORY_COUNT));
      plot.setRenderer(renderer);

      // OPTIONAL CUSTOMISATION COMPLETED.
     return chart;
  }
项目:HTML5_WebSite    文件:StatisticalLineChartDemo1a.java   
/**
 * Creates a sample chart.
 * 
 * @param dataset  a dataset.
 * 
 * @return The chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {

    // create the chart...
    JFreeChart chart = ChartFactory.createLineChart(
        chartTitle,       // chart title
        domainLabel,                    // domain axis label
        rangeLabel,                   // range axis label
        dataset,                   // data
        PlotOrientation.VERTICAL,  // orientation
        !legendPanelOn,                      // include legend
        true,                      // tooltips
        false                      // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);

    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.white);

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setUpperMargin(0.0);
    domainAxis.setLowerMargin(0.0);

    // customise the range axis...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setAutoRangeIncludesZero(true);

    // customise the renderer...
    StatisticalLineAndShapeRenderer renderer 
        = new StatisticalLineAndShapeRenderer(true, false);
    plot.setRenderer(renderer);

    // OPTIONAL CUSTOMISATION COMPLETED.
   return chart;
}
项目:HTML5_WebSite    文件:ChartGenerator_JTable.java   
private JFreeChart createCategoryLineStatChart(String title, String xLabel, String yLabel, CategoryDataset dataset) {
 // create the chart...
    JFreeChart chart = ChartFactory.createLineChart(
        title,       // chart title
        xLabel,                    // domain axis label
        yLabel,                   // range axis label
        dataset,                   // data
        orientation,  // orientation
        true,                      // include legend
        true,                      // tooltips
        false                      // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);

    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.white);

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setUpperMargin(0.0);
    domainAxis.setLowerMargin(0.0);

    // customise the range axis...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setAutoRangeIncludesZero(true);

    // customise the renderer...
    StatisticalLineAndShapeRenderer renderer
        = new StatisticalLineAndShapeRenderer(true, false);
    plot.setRenderer(renderer);

    // OPTIONAL CUSTOMISATION COMPLETED.
   return chart;
}
项目:nabs    文件:StatisticalLineAndShapeRendererTests.java   
/**
 * Check that the equals() method distinguishes all fields.
 */
public void testEquals() {
    StatisticalLineAndShapeRenderer r1 
        = new StatisticalLineAndShapeRenderer();
    StatisticalLineAndShapeRenderer r2 
        = new StatisticalLineAndShapeRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));

    r1.setErrorIndicatorPaint(Color.red);
    assertFalse(r1.equals(r2));
    r2.setErrorIndicatorPaint(Color.red);
    assertTrue(r2.equals(r1));
}
项目:nabs    文件:StatisticalLineAndShapeRendererTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    StatisticalLineAndShapeRenderer r1 
        = new StatisticalLineAndShapeRenderer();
    StatisticalLineAndShapeRenderer r2 
        = new StatisticalLineAndShapeRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
项目:astor    文件:StatisticalLineAndShapeRendererTests.java   
/**
 * Check that the equals() method distinguishes all fields.
 */
public void testEquals() {
    StatisticalLineAndShapeRenderer r1
        = new StatisticalLineAndShapeRenderer();
    StatisticalLineAndShapeRenderer r2
        = new StatisticalLineAndShapeRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));

    r1.setErrorIndicatorPaint(Color.red);
    assertFalse(r1.equals(r2));
    r2.setErrorIndicatorPaint(Color.red);
    assertTrue(r2.equals(r1));
}
项目:astor    文件:StatisticalLineAndShapeRendererTests.java   
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashcode() {
    StatisticalLineAndShapeRenderer r1
        = new StatisticalLineAndShapeRenderer();
    StatisticalLineAndShapeRenderer r2
        = new StatisticalLineAndShapeRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
项目:astor    文件:StatisticalLineAndShapeRendererTests.java   
/**
 * Check that this class implements PublicCloneable.
 */
public void testPublicCloneable() {
    StatisticalLineAndShapeRenderer r1
            = new StatisticalLineAndShapeRenderer();
    assertTrue(r1 instanceof PublicCloneable);
}
项目:aorra    文件:CoralCover.java   
private static JFreeChart createChart(final ADSCDataset dataset, ChartType type) {
    JFreeChart chart = ChartFactory.createLineChart(
            dataset.get(Attribute.TITLE),  // title
            dataset.get(Attribute.X_AXIS_LABEL),  // x-axis label
            dataset.get(Attribute.Y_AXIS_LABEL),  // y-axis label
            dataset,            // data
            PlotOrientation.VERTICAL,
            false,               // create legend?
            false,               // generate tooltips?
            false               // generate URLs?
        );
    chart.setBackgroundPaint(Color.white);
    StatisticalLineAndShapeRenderer renderer = new StatisticalLineAndShapeRenderer();
    renderer.setErrorIndicatorPaint(ErrorIndicator.ERROR_INDICATOR_COLOR);
    CategoryPlot plot = (CategoryPlot)chart.getPlot();
    plot.setRenderer(renderer);
    plot.setRangeGridlinePaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlineStroke(new BasicStroke(1.0f));
    plot.setDomainGridlinesVisible(false);
    plot.setBackgroundPaint(Color.white);
    renderer.setDrawOutlines(true);
    renderer.setUseOutlinePaint(true);
    renderer.setUseFillPaint(false);
    plot.setDrawingSupplier(new DrawingSupplier() {
        @Override
        public Paint getNextPaint() {
          return dataset.get(Attribute.SERIES_COLOR);
        }

        @Override
        public Paint getNextOutlinePaint() {
            return Color.black;
        }

        @Override
        public Paint getNextFillPaint() {
            return null;
        }

        @Override
        public Stroke getNextStroke() {
            return new BasicStroke(1.0f);
        }

        @Override
        public Stroke getNextOutlineStroke() {
            return new BasicStroke(1.0f);
        }

        @Override
        public Shape getNextShape() {
            return AbstractRenderer.DEFAULT_SHAPE;
        }});
    renderer.setBaseOutlinePaint(Color.black);
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setTickMarksVisible(false);
    rangeAxis.setRange(0, parseDouble(dataset.get(Attribute.Y_AXIS_RANGE), 100.0));
    rangeAxis.setTickUnit(new NumberTickUnit(parseDouble(
        dataset.get(Attribute.Y_AXIS_TICKS), 10.0), new DecimalFormat("0")));
    chart.getTitle().setFont(rangeAxis.getLabelFont());
    chart.addLegend(ErrorIndicatorLegend.createLegend());
    return chart;
}