当前位置: 首页>>代码示例>>Java>>正文


Java CategoryPlot.getRangeAxis方法代码示例

本文整理汇总了Java中org.jfree.chart.plot.CategoryPlot.getRangeAxis方法的典型用法代码示例。如果您正苦于以下问题:Java CategoryPlot.getRangeAxis方法的具体用法?Java CategoryPlot.getRangeAxis怎么用?Java CategoryPlot.getRangeAxis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.chart.plot.CategoryPlot的用法示例。


在下文中一共展示了CategoryPlot.getRangeAxis方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testReplaceDataset

import org.jfree.chart.plot.CategoryPlot; //导入方法依赖的package包/类
/**
 * Replaces the chart's dataset and then checks that the new dataset is OK.
 */
public void testReplaceDataset() {

    // create a dataset...
    Number[][] data = new Integer[][]
        {{new Integer(-30), new Integer(-20)},
         {new Integer(-10), new Integer(10)},
         {new Integer(20), new Integer(30)}};

    CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", 
            "C", data);

    LocalListener l = new LocalListener();
    this.chart.addChangeListener(l);
    CategoryPlot plot = (CategoryPlot) this.chart.getPlot();
    plot.setDataset(newData);
    assertEquals(true, l.flag);
    ValueAxis axis = plot.getRangeAxis();
    Range range = axis.getRange();
    assertTrue("Expecting the lower bound of the range to be around -30: "
               + range.getLowerBound(), range.getLowerBound() <= -30);
    assertTrue("Expecting the upper bound of the range to be around 30: "
               + range.getUpperBound(), range.getUpperBound() >= 30);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:LineChart3DTests.java

示例2: testReplaceDataset

import org.jfree.chart.plot.CategoryPlot; //导入方法依赖的package包/类
/**
 * Replaces the chart's dataset and then checks that the new dataset is OK.
 */
public void testReplaceDataset() {
    Number[][] data = new Integer[][]
        {{new Integer(-30), new Integer(-20)},
         {new Integer(-10), new Integer(10)},
         {new Integer(20), new Integer(30)}};

    CategoryDataset newData = DatasetUtilities.createCategoryDataset(
            "S", "C", data);
    LocalListener l = new LocalListener();
    this.chart.addChangeListener(l);
    CategoryPlot plot = (CategoryPlot) this.chart.getPlot();
    plot.setDataset(newData);
    assertEquals(true, l.flag);
    ValueAxis axis = plot.getRangeAxis();
    Range range = axis.getRange();
    assertTrue("Expecting the lower bound of the range to be around -30: "
               + range.getLowerBound(), range.getLowerBound() <= -30);
    assertTrue("Expecting the upper bound of the range to be around 30: "
               + range.getUpperBound(), range.getUpperBound() >= 30);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:AreaChartTests.java

示例3: testAutoRange3

import org.jfree.chart.plot.CategoryPlot; //导入方法依赖的package包/类
/**
 * A simple test for the auto-range calculation looking at a
 * NumberAxis used as the range axis for a CategoryPlot.  In this
 * case, the 'autoRangeIncludesZero' flag is set to false AND the
 * original dataset is replaced with a new dataset.
 */
public void testAutoRange3() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(100.0, "Row 1", "Column 1");
    dataset.setValue(200.0, "Row 1", "Column 2");
    JFreeChart chart = ChartFactory.createLineChart("Test", "Categories",
            "Value", dataset, PlotOrientation.VERTICAL, false, false,
            false);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    NumberAxis axis = (NumberAxis) plot.getRangeAxis();
    axis.setAutoRangeIncludesZero(false);
    assertEquals(axis.getLowerBound(), 95.0, EPSILON);    
    assertEquals(axis.getUpperBound(), 205.0, EPSILON);    
    
    // now replacing the dataset should update the axis range...
    DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
    dataset2.setValue(900.0, "Row 1", "Column 1");
    dataset2.setValue(1000.0, "Row 1", "Column 2");
    plot.setDataset(dataset2);
    assertEquals(axis.getLowerBound(), 895.0, EPSILON);    
    assertEquals(axis.getUpperBound(), 1005.0, EPSILON);    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:NumberAxisTests.java

示例4: createChart

import org.jfree.chart.plot.CategoryPlot; //导入方法依赖的package包/类
/**
     * Creates a sample chart.
     *
     * @param dataset  the dataset.
     *
     * @return The chart.
     */
    private static JFreeChart createChart(CategoryDataset dataset) {
        JFreeChart chart = ChartFactory.createBarChart(
            "Performance: JFreeSVG vs Batik", null /* x-axis label*/, 
                "Milliseconds" /* y-axis label */, dataset, PlotOrientation.HORIZONTAL,false,false,false);
        chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " 
                + "format (lower bars = better performance)"));
        chart.setBackgroundPaint(Color.white);
        CategoryPlot plot = (CategoryPlot) chart.getPlot();

        // ******************************************************************
        //  More than 150 demo applications are included with the JFreeChart
        //  Developer Guide...for more information, see:
        //
        //  >   http://www.object-refinery.com/jfreechart/guide.html
        //
        // ******************************************************************

        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
        BarRenderer renderer = (BarRenderer) plot.getRenderer();
        renderer.setDrawBarOutline(false);
//        chart.getLegend().setFrame(BlockBorder.NONE);
        return chart;
    }
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:32,代码来源:BarChartDemo1.java

示例5: visualizarSerieChartAsignRescateVict

import org.jfree.chart.plot.CategoryPlot; //导入方法依赖的package包/类
public void  visualizarSerieChartAsignRescateVict(Color color,CategoryDataset dataset) {
     ChartPanel chartPanel = new ChartPanel(chartNotifAsigResc);
     chartNotifAsigResc.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chartNotifAsigResc.getPlot();
     plot.setBackgroundPaint(color);
     plot.setDataset(dataset);
     plot.setDomainGridlinePaint(Color.white);
     plot.setRangeGridlinePaint(Color.white);
     NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
     rangeAxis.setUpperMargin(0.15);
     CategoryItemRenderer renderer = plot.getRenderer();
     renderer.setItemLabelGenerator(new LabelGenerator(50.0));
     renderer.setItemLabelFont(new Font("Serif", Font.PLAIN, 8));
     renderer.setItemLabelsVisible(true);
     chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
   setContentPane(chartPanel);
   this.pack();
   RefineryUtilities.centerFrameOnScreen(this);
   this.setVisible(true);
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:21,代码来源:VisualizacionJfreechart.java

示例6: testAutoRange1

import org.jfree.chart.plot.CategoryPlot; //导入方法依赖的package包/类
/**
 * A simple test for the auto-range calculation looking at a
 * NumberAxis used as the range axis for a CategoryPlot.
 */
public void testAutoRange1() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(100.0, "Row 1", "Column 1");
    dataset.setValue(200.0, "Row 1", "Column 2");
    JFreeChart chart = ChartFactory.createBarChart(
        "Test", 
        "Categories",
        "Value",
        dataset,
        PlotOrientation.VERTICAL,
        false, 
        false,
        false
    );
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    NumberAxis axis = (NumberAxis) plot.getRangeAxis();
    assertEquals(axis.getLowerBound(), 0.0, EPSILON);    
    assertEquals(axis.getUpperBound(), 210.0, EPSILON);    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:NumberAxisTests.java

示例7: testReplaceDataset

import org.jfree.chart.plot.CategoryPlot; //导入方法依赖的package包/类
/**
 * Replaces the dataset and checks that it has changed as expected.
 */
public void testReplaceDataset() {

    // create a dataset...
    Number[][] data = new Integer[][]
        {{new Integer(-30), new Integer(-20)},
         {new Integer(-10), new Integer(10)},
         {new Integer(20), new Integer(30)}};

    CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", 
            "C", data);

    LocalListener l = new LocalListener();
    this.chart.addChangeListener(l);
    CategoryPlot plot = (CategoryPlot) this.chart.getPlot();
    plot.setDataset(newData);
    assertEquals(true, l.flag);
    ValueAxis axis = plot.getRangeAxis();
    Range range = axis.getRange();
    assertTrue("Expecting the lower bound of the range to be around -30: "
                + range.getLowerBound(), range.getLowerBound() <= -30);
    assertTrue("Expecting the upper bound of the range to be around 30: "
               + range.getUpperBound(), range.getUpperBound() >= 30);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:StackedBarChartTests.java

示例8: testReplaceDataset

import org.jfree.chart.plot.CategoryPlot; //导入方法依赖的package包/类
/**
 * Replaces the dataset and checks that the data range is as expected.
 */
public void testReplaceDataset() {

    // create a dataset...
    Number[][] data = new Integer[][]
        {{new Integer(-30), new Integer(-20)},
         {new Integer(-10), new Integer(10)},
         {new Integer(20), new Integer(30)}};

    CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", 
            "C", data);

    LocalListener l = new LocalListener();
    this.chart.addChangeListener(l);
    CategoryPlot plot = (CategoryPlot) this.chart.getPlot();
    plot.setDataset(newData);
    assertEquals(true, l.flag);
    ValueAxis axis = plot.getRangeAxis();
    Range range = axis.getRange();
    assertTrue("Expecting the lower bound of the range to be around -30: "
            + range.getLowerBound(), range.getLowerBound() <= -30);
    assertTrue("Expecting the upper bound of the range to be around 30: "
            + range.getUpperBound(), range.getUpperBound() >= 30);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:BarChart3DTests.java

示例9: setYAixs

import org.jfree.chart.plot.CategoryPlot; //导入方法依赖的package包/类
public static void setYAixs(CategoryPlot plot) {
    Color lineColor = new Color(192, 208, 224);
    ValueAxis axis = plot.getRangeAxis();
    axis.setAxisLinePaint(lineColor);
    axis.setTickMarkPaint(lineColor);
    axis.setAxisLineVisible(false);
    axis.setTickMarksVisible(false);
    plot.setRangeGridlinePaint(new Color(192, 192, 192));
    plot.setRangeGridlineStroke(new BasicStroke(1));

    plot.getRangeAxis().setUpperMargin(0.1);
    plot.getRangeAxis().setLowerMargin(0.1);

}
 
开发者ID:Fanping,项目名称:iveely.ml,代码行数:15,代码来源:ChartUtils.java

示例10: getChart

import org.jfree.chart.plot.CategoryPlot; //导入方法依赖的package包/类
@Override
public JFreeChart getChart() throws IOException {

    final DefaultStatisticalCategoryDataset dataset = getDataset();
    final JFreeChart chart = ChartFactory.createLineChart(getName(), x_axis_label, "Time to reach " + name + " (s)", dataset, PlotOrientation.VERTICAL, showLegend, false, false);
    final StatisticalBarRenderer renderer = new StatisticalBarRenderer();
    final CategoryPlot category_plot = chart.getCategoryPlot();
    category_plot.setRenderer(renderer);

    final ValueAxis range_axis = category_plot.getRangeAxis();
    range_axis.setLowerBound(0);

    PlainChartTheme.applyTheme(chart);
    return chart;
}
 
开发者ID:stacs-srg,项目名称:shabdiz,代码行数:16,代码来源:TimeToReachStateAnalyzer.java

示例11: createChart

import org.jfree.chart.plot.CategoryPlot; //导入方法依赖的package包/类
public void createChart(final SortedMap stats, final OutputStream out) throws IOException {

    final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (final Iterator iter = stats.entrySet().iterator(); iter.hasNext();) {
      final Map.Entry entry = (Map.Entry)iter.next();
      final Integer buildNumber = (Integer)entry.getKey();
      final Integer violations = (Integer)entry.getValue();
      dataset.addValue(violations, categoryDescription, buildNumber);
    }

    // create the chart object

    // This generates a stacked bar - more suitable
    final JFreeChart chart = ChartFactory.createLineChart(null,
      "Recent builds", valueAxisLabel, dataset,
      PlotOrientation.VERTICAL,
      true, false, false);
    chart.setBackgroundPaint(Color.white);

    // change the auto tick unit selection to integer units only
    final CategoryPlot plot = chart.getCategoryPlot();
    final NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // rotate X dates
    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

    // set bar colors

    final LineAndShapeRenderer line = (LineAndShapeRenderer)plot.getRenderer();
    line.setSeriesPaint(0, Color.RED);
    line.setStroke(StatisticsUtils.DEFAULT_LINE_STROKE);

    // write to reposnce
    final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
    ChartUtilities.writeChartAsPNG(out, chart, StatisticsUtils.IMG_WIDTH, StatisticsUtils.IMG_HEIGHT, info);
  }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:39,代码来源:CodeAnalysisChartGenerator.java

示例12: crearBarChartCosteEnergiaRescateVictimas

import org.jfree.chart.plot.CategoryPlot; //导入方法依赖的package包/类
public void crearBarChartCosteEnergiaRescateVictimas(CategoryDataset dataset) {
         JFreeChart chart = ChartFactory.createBarChart(
        "Energ�a consumida para salvar las victimas ", // chart title
        "Victimas ordenadas por tiempo de rescate", // domain axis label
        "Energ�a consumida", // range axis label
        dataset, // data
        PlotOrientation.VERTICAL, // orientation
        true, // include legend
        true, // tooltips?
        false // URLs?
        );
        ChartPanel chartPanel = new ChartPanel(chart);
        chart.setBackgroundPaint(Color.white);
        CategoryPlot plot = chart.getCategoryPlot();
        plot.setBackgroundPaint(Color.lightGray);
        plot.setDomainGridlinePaint(Color.white);
        plot.setRangeGridlinePaint(Color.white);
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setUpperMargin(0.15);
        CategoryItemRenderer renderer = plot.getRenderer();
        renderer.setItemLabelGenerator(new LabelGenerator(50.0));
        renderer.setItemLabelFont(new Font("Serif", Font.PLAIN, 8));
        renderer.setItemLabelsVisible(true);
        chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
      setContentPane(chartPanel);
      this.pack();
      RefineryUtilities.centerFrameOnScreen(this);
      this.setVisible(true);
//        return chart;
            }
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:31,代码来源:VisualizacionJfreechart.java

示例13: crearChartAsignRescateVict

import org.jfree.chart.plot.CategoryPlot; //导入方法依赖的package包/类
public  JFreeChart crearChartAsignRescateVict(CategoryDataset dataset) {
       
       chartNotifAsigResc = ChartFactory.createLineChart(
          "Tiempos de Rescate de Victimas ",      // chart title Titulo local del grafico
          "Victimas Rescatadas  en Entorno",                      // x axis label
          "Tiempo milisegundos",                      // y axis label
          dataset,                  // data
          PlotOrientation.VERTICAL,
          true,                     // include legend
          true,                     // tooltips
          false                     // urls
      );

      // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
      ChartPanel chartPanel = new ChartPanel(chartNotifAsigResc,false);
        chartNotifAsigResc.setBackgroundPaint(Color.white);
//       CategoryPlot plot = (CategoryPlot) chartNotifAsigResc.getPlot();
        CategoryPlot plot = chartNotifAsigResc.getCategoryPlot();
        plot.setBackgroundPaint(Color.lightGray);
        plot.setDomainGridlinePaint(Color.white);
        plot.setRangeGridlinePaint(Color.white);
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setUpperMargin(0.15);
        CategoryItemRenderer renderer = plot.getRenderer();
        renderer.setItemLabelGenerator(new LabelGenerator(50.0));
        renderer.setItemLabelFont(new Font("Serif", Font.PLAIN, 8));
        renderer.setItemLabelsVisible(true);
        chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
      setContentPane(chartPanel);
      this.pack();
      RefineryUtilities.centerFrameOnScreen(this);
      this.setVisible(true);
      return chartNotifAsigResc;
    }
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:35,代码来源:VisualizacionJfreechart.java

示例14: createRecentBuildTimesChart

import org.jfree.chart.plot.CategoryPlot; //导入方法依赖的package包/类
public static void createRecentBuildTimesChart(final SortedMap stats, final String categoryLabel, final OutputStream out) throws IOException {

    final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (final Iterator iter = stats.entrySet().iterator(); iter.hasNext();) {
      final Map.Entry entry = (Map.Entry) iter.next();
      final Integer buildNumber = (Integer) entry.getKey();
      final Integer timeInSeconds = (Integer) entry.getValue();
      dataset.addValue(timeInSeconds, "Build time", buildNumber);
    }

    // create the chart object

    // This generates a stacked bar - more suitable
    final JFreeChart chart = ChartFactory.createLineChart(null,
            categoryLabel, "Build time", dataset,
            PlotOrientation.VERTICAL,
            true, false, false);
    chart.setBackgroundPaint(Color.white);

    // change the auto tick unit selection to integer units only
    final CategoryPlot plot = chart.getCategoryPlot();
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setStandardTickUnits(createWordedTimeTickUnits());

    // rotate X dates
    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

    // set bar colors

    final LineAndShapeRenderer line = (LineAndShapeRenderer) plot.getRenderer();
    line.setSeriesPaint(0, Color.BLUE);
    line.setStroke(DEFAULT_LINE_STROKE);

    // write to reposnce
    final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
    ChartUtilities.writeChartAsPNG(out, chart, IMG_WIDTH, IMG_HEIGHT, info);
  }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:40,代码来源:StatisticsUtils.java

示例15: getVerticalValueAxis

import org.jfree.chart.plot.CategoryPlot; //导入方法依赖的package包/类
/**
 * Returns a reference to the 'vertical' value axis, if there is one.
 *
 * @param plot  the plot.
 *
 * @return The axis.
 */
private ValueAxis getVerticalValueAxis(Plot plot) {

    if (plot == null) {
        return null;
    }

    ValueAxis axis = null;

    if (plot instanceof CategoryPlot) {
        CategoryPlot cp = (CategoryPlot) plot;
        if (cp.getOrientation() == PlotOrientation.VERTICAL) {
            axis = cp.getRangeAxis();
        }
    }

    if (plot instanceof XYPlot) {
        XYPlot xyp = (XYPlot) plot;
        if (xyp.getOrientation() == PlotOrientation.HORIZONTAL) {
            axis = xyp.getDomainAxis();
        }
        else if (xyp.getOrientation() == PlotOrientation.VERTICAL) {
            axis = xyp.getRangeAxis();
        }
    }
    
    if (plot instanceof FastScatterPlot) {
        FastScatterPlot fsp = (FastScatterPlot) plot;
        axis = fsp.getRangeAxis();            
    }

    return axis;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:41,代码来源:ChartPanel.java


注:本文中的org.jfree.chart.plot.CategoryPlot.getRangeAxis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。