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


Java JFreeChart.getCategoryPlot方法代码示例

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


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

示例1: visualizarSeriesTiemposRescateVictPorRobots

import org.jfree.chart.JFreeChart; //导入方法依赖的package包/类
public void  visualizarSeriesTiemposRescateVictPorRobots(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(
     "Tiempos de Rescate de Victimas por cada robot ", // chart title
     "Robots en el entorno", // domain axis label
     "Tiempo milisegundos", // 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));
     this.visualizar(chartPanel);
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:27,代码来源:VisualizacionJfreechart.java

示例2: getChart

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


    final JFreeChart chart = ChartFactory.createLineChart("Time to reach uniform state", "Application State", "Time to reach state (s)", getDataset(), PlotOrientation.VERTICAL, false, false, false);
    final CategoryPlot category_plot = chart.getCategoryPlot();
    category_plot.setRenderer(new StatisticalBarRenderer());
    category_plot.getRangeAxis().setLowerBound(0);
    PlainChartTheme.applyTheme(chart);
    return chart;
}
 
开发者ID:stacs-srg,项目名称:shabdiz,代码行数:12,代码来源:TimeToReachStateAllInOneAnalyzer.java

示例3: getChart

import org.jfree.chart.JFreeChart; //导入方法依赖的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

示例4: createBarChart

import org.jfree.chart.JFreeChart; //导入方法依赖的package包/类
private static  JFreeChart createBarChart(String title,String category,String value, CategoryDataset dataset) {   
	    JFreeChart chart = ChartFactory.createBarChart3D(title, // chart title   
	    			category, // domain axis label   
	    			value, // range axis label   
	                dataset, // data   
	                PlotOrientation.VERTICAL, // 图标方向   
	                true, // 是否显示legend   
	                true, // 是否显示tooltips   
	                false // 是否显示URLs   
	        );   
	    CategoryPlot plot = chart.getCategoryPlot();//设置图的高级属性 
	    plot.setBackgroundPaint(ChartColor.WHITE);
	    NumberAxis na= (NumberAxis)plot.getRangeAxis();
//	    na.setAutoTickUnitSelection(false);//设置小数点位数
	    na.setNumberFormatOverride(df);
//	    NumberTickUnit nt=new NumberTickUnit(1.22);
//	    na.setTickUnit(nt);
//	    plot.setRangeAxis(na);
	    BarRenderer3D renderer = new BarRenderer3D();//3D属性修改 
	    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
	    renderer.setBaseItemLabelsVisible(true);
	    renderer.setItemLabelAnchorOffset(10);
	    renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_CENTER));
		renderer.setSeriesPaint(0,new Color(34,139,34));
		renderer.setSeriesPaint(1,new Color(154,205,50));
		renderer.setSeriesPaint(2,new Color(0,255,0));
		renderer.setSeriesPaint(3,new Color(127,255,212));
	    plot.setRenderer(renderer);//将修改后的属性值保存到图中 
	    return chart;   
	}
 
开发者ID:dbiir,项目名称:ts-benchmark,代码行数:31,代码来源:ChartBizUtil.java

示例5: BarChart

import org.jfree.chart.JFreeChart; //导入方法依赖的package包/类
public BarChart() {
    CategoryDataset dataset = getDataSet();
    JFreeChart chart = ChartFactory.createBarChart3D(
            "水果", // 图表标题
            "水果种类", // 目录轴的显示标签
            "数量", // 数值轴的显示标签
            dataset, // 数据集
            PlotOrientation.VERTICAL, // 图表方向:水平、垂直
            true,           // 是否显示图例(对于简单的柱状图必须是false)
            false,          // 是否生成工具
            false           // 是否生成URL链接
    );

    //从这里开始
    CategoryPlot plot = chart.getCategoryPlot();//获取图表区域对象
    CategoryAxis domainAxis = plot.getDomainAxis();         //水平底部列表
    domainAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));         //水平底部标题
    domainAxis.setTickLabelFont(new Font("宋体", Font.BOLD, 12));  //垂直标题
    ValueAxis rangeAxis = plot.getRangeAxis();//获取柱状
    rangeAxis.setLabelFont(new Font("黑体", Font.BOLD, 15));
    chart.getLegend().setItemFont(new Font("黑体", Font.BOLD, 15));
    chart.getTitle().setFont(new Font("宋体", Font.BOLD, 20));//设置标题字体

    //到这里结束,虽然代码有点多,但只为一个目的,解决汉字乱码问题

    frame1 = new ChartPanel(chart, true);        //这里也可以用chartFrame,可以直接生成一个独立的Frame

}
 
开发者ID:leon66666,项目名称:financehelper,代码行数:29,代码来源:BarChart.java

示例6: crearBarChartCosteEnergiaRescateVictimas

import org.jfree.chart.JFreeChart; //导入方法依赖的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

示例7: createChart

import org.jfree.chart.JFreeChart; //导入方法依赖的package包/类
/**
 * Creates a chart for recent time to fix.
 *
 */
public void createChart(final SortedMap time, final String valueKey, final Color lineColor, final OutputStream out) throws IOException {

  final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
  addTimeToDataSet(dataset, time, valueKey);

  // create the chart object

  // This generates a stacked bar - more suitable

  final JFreeChart chart = ChartFactory.createLineChart(null,
    "Recent builds", "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(StatisticsUtils.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, lineColor);
  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,代码行数:42,代码来源:BuildTimeChartGenerator.java

示例8: createChart

import org.jfree.chart.JFreeChart; //导入方法依赖的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

示例9: createTestsResultsChartHelper

import org.jfree.chart.JFreeChart; //导入方法依赖的package包/类
/**
   *
   */
  private static void createTestsResultsChartHelper(final String categoryLabel, final DefaultCategoryDataset dataset, final OutputStream out, final CategoryLabelPositions categoryLabelPosition) throws IOException {
    final JFreeChart chart = ChartFactory.createStackedAreaChart(null,
            categoryLabel, "Tests", 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 LogarithmicAxis logarithmicAxis = new LogarithmicAxis("Tests");
    logarithmicAxis.setStrictValuesFlag(false);
    logarithmicAxis.setAutoRangeIncludesZero(true);
    logarithmicAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    plot.setRangeAxis(logarithmicAxis);
//    final NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();

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

    // set area colors

    final StackedAreaRenderer area = (StackedAreaRenderer) plot.getRenderer();
    area.setSeriesPaint(0, Color.RED); // first area
    area.setSeriesPaint(1, Color.PINK); // second area
    area.setSeriesPaint(2, Color.GREEN); // thirs area
    //plot.setRenderer(area);

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

示例10: createHourlyBreakageDistributionChart

import org.jfree.chart.JFreeChart; //导入方法依赖的package包/类
public static void createHourlyBreakageDistributionChart(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 hour = (Integer) entry.getKey();
      final BuildStatistics bst = (BuildStatistics) entry.getValue();
      dataset.addValue(new Integer(bst.getFailedBuilds()), "Failed builds", hour);
    }

    // create the chart object

    // This generates a stacked bar - more suitable
    final JFreeChart chart = ChartFactory.createStackedBarChart(null,
            categoryLabel, "Builds", 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());

    // set bar colors
    final BarRenderer bar = (BarRenderer) plot.getRenderer();
    bar.setItemMargin(0); // reduce the width between the bars.
    bar.setSeriesPaint(0, Color.RED); // first bar

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

示例11: createRecentBuildTimesChart

import org.jfree.chart.JFreeChart; //导入方法依赖的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

示例12: createDayOfWeekBreakageDistributionChart

import org.jfree.chart.JFreeChart; //导入方法依赖的package包/类
public static void createDayOfWeekBreakageDistributionChart(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 dayOfWeek = (Integer) entry.getKey();
      final BuildStatistics bst = (BuildStatistics) entry.getValue();
      dataset.addValue(new Integer(bst.getFailedBuilds()), "Failed builds", new ComparableDayOfWeek(dayOfWeek));
    }

    // create the chart object

    // This generates a stacked bar - more suitable
    final JFreeChart chart = ChartFactory.createStackedBarChart(null,
            categoryLabel, "Builds", 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());

    // set bar colors
    final BarRenderer bar = (BarRenderer) plot.getRenderer();
    bar.setItemMargin(0); // reduce the width between the bars.
    bar.setSeriesPaint(0, Color.RED); // first bar

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

示例13: createNominalChart

import org.jfree.chart.JFreeChart; //导入方法依赖的package包/类
private JFreeChart createNominalChart() {
	JFreeChart chart;
	CategoryDataset dataset = createNominalDataSet();

	// create the chart...
	String domainName = dataTable == null ? MODEL_DOMAIN_AXIS_NAME : dataTable.getColumnName(plotColumn);
	chart = ChartFactory.createBarChart(null, // chart title
			domainName, // x axis label
			RANGE_AXIS_NAME, // y axis label
			dataset, // data
			PlotOrientation.VERTICAL, true, // include legend
			true, // tooltips
			false // urls
			);

	CategoryPlot plot = chart.getCategoryPlot();

	BarRenderer renderer = new BarRenderer();
	if (dataset.getRowCount() == 1) {
		renderer.setSeriesPaint(0, Color.RED);
		renderer.setSeriesFillPaint(0, Color.RED);
	} else {
		for (int i = 0; i < dataset.getRowCount(); i++) {
			Color color = getColorProvider(true).getPointColor((double) i / (double) (dataset.getRowCount() - 1));
			renderer.setSeriesPaint(i, color);
			renderer.setSeriesFillPaint(i, color);
		}
	}
	renderer.setBarPainter(new RapidBarPainter());
	renderer.setDrawBarOutline(true);
	plot.setRenderer(renderer);

	// rotate labels
	if (isLabelRotating()) {
		plot.getDomainAxis().setTickLabelsVisible(true);
		plot.getDomainAxis().setCategoryLabelPositions(
				CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0d));
	}

	return chart;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:42,代码来源:DistributionPlotter.java

示例14: createChart

import org.jfree.chart.JFreeChart; //导入方法依赖的package包/类
private JFreeChart createChart() {
	if (data.getItemCount() > 0) {
		// get cumulative percentages
		KeyedValues cumulative = DataUtilities.getCumulativePercentages(data);

		CategoryDataset categoryDataset = DatasetUtilities.createCategoryDataset(
				"Count for " + this.dataTable.getColumnName(this.countColumn) + " = " + countValue, data);

		// create the chart...
		final JFreeChart chart = ChartFactory.createBarChart(null, // chart title
				this.dataTable.getColumnName(this.groupByColumn), // domain axis label
				"Count", // range axis label
				categoryDataset, // data
				PlotOrientation.VERTICAL, true, // include legend
				true, false);

		// set the background color for the chart...
		chart.setBackgroundPaint(Color.WHITE);

		// get a reference to the plot for further customization...
		CategoryPlot plot = chart.getCategoryPlot();

		CategoryAxis domainAxis = plot.getDomainAxis();
		domainAxis.setLowerMargin(0.02);
		domainAxis.setUpperMargin(0.02);
		domainAxis.setLabelFont(LABEL_FONT_BOLD);
		domainAxis.setTickLabelFont(LABEL_FONT);

		// set the range axis to display integers only...
		NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
		rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits(Locale.US));
		rangeAxis.setLabelFont(LABEL_FONT_BOLD);
		rangeAxis.setTickLabelFont(LABEL_FONT);

		// second data set (cumulative percentages)
		CategoryDataset dataset2 = DatasetUtilities.createCategoryDataset("Cumulative (Percent)", cumulative);

		LineAndShapeRenderer renderer2 = new LineAndShapeRenderer();
		renderer2.setSeriesPaint(0, SwingTools.VERY_DARK_BLUE.darker());

		NumberAxis axis2 = new NumberAxis("Percent of " + countValue);
		axis2.setNumberFormatOverride(NumberFormat.getPercentInstance());
		axis2.setLabelFont(LABEL_FONT_BOLD);
		axis2.setTickLabelFont(LABEL_FONT);

		plot.setRangeAxis(1, axis2);
		plot.setDataset(1, dataset2);
		plot.setRenderer(1, renderer2);
		plot.mapDatasetToRangeAxis(1, 1);

		axis2.setTickUnit(new NumberTickUnit(0.1));

		// show grid lines
		plot.setRangeGridlinesVisible(true);

		// bring cumulative line to front
		plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

		if (isLabelRotating()) {
			domainAxis.setTickLabelsVisible(true);
			domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0d));
		}

		return chart;
	} else {
		return null;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:69,代码来源:ParetoChartPlotter.java

示例15: generate

import org.jfree.chart.JFreeChart; //导入方法依赖的package包/类
public ImmutableImage generate(final List samples) {
  try {
    final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (int i = 0; i < samples.size(); i++) {
      final AgentStatusSample sample = (AgentStatusSample) samples.get(i);
      dataset.addValue(sample.getBusyCounter(), "Load", new ColumnKey(i));
    }

    final JFreeChart chart = ChartFactory.createLineChart(null,
            "Last 24 Hours", "Builds", dataset,
            PlotOrientation.VERTICAL,
            false, 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.BLUE);
    line.setStroke(StatisticsUtils.DEFAULT_LINE_STROKE);

    // Write to byte array

    final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
    final ByteArrayOutputStream out = new ByteArrayOutputStream(1000);
    ChartUtilities.writeChartAsPNG(out, chart, width, height, info);
    out.flush();
    out.close();

    // Return result
    return new ImmutableImage(out.toByteArray(), width, height);
  } catch (IOException e) {
    final ErrorManager errorManager = ErrorManagerFactory.getErrorManager();
    final Error error = new Error("Error generating agent status chart: " + StringUtils.toString(e), e);
    errorManager.reportSystemError(error);
    return ImmutableImage.ZERO_SIZE_IMAGE;
  }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:49,代码来源:AgentStatusChartGenerator.java


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