當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。