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


Java BarRenderer.setSeriesPaint方法代码示例

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


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

示例1: configureBarRenderer

import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
private static void configureBarRenderer(BarRenderer renderer, ValueSource valueSource, PlotInstance plotInstance) {
	StandardBarPainter barPainter = new StandardBarPainter();
	renderer.setBarPainter(barPainter);
	renderer.setGradientPaintTransformer(null);

	ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource);
	int seriesCount = valueSourceData.getSeriesCount();
	DimensionConfig domainConfig = valueSource.getDomainConfig();
	DimensionConfig colorDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig(
			PlotDimension.COLOR);
	SeriesFormat seriesFormat = valueSource.getSeriesFormat();

	// Loop all series and set series format.
	// Format based on dimension configs will be set later on in initFormatDelegate().
	for (int seriesIdx = 0; seriesIdx < seriesCount; ++seriesIdx) {
		// configure series paint if necessary
		if (!SeriesFormat.calculateIndividualFormatForEachItem(domainConfig, colorDimensionConfig)) {
			renderer.setSeriesPaint(seriesIdx, seriesFormat.getAreaFillPaint());
		}

		// configure general style of the bars
		renderer.setShadowVisible(false);
		renderer.setSeriesOutlinePaint(seriesIdx, PlotConfiguration.DEFAULT_SERIES_OUTLINE_PAINT);
	}
	renderer.setDrawBarOutline(true);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:27,代码来源:ChartRendererFactory.java

示例2: createBarChart

import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
/**
 * Creates the histogram chart.
 * 
 * @return
 */
private JFreeChart createBarChart() {
	JFreeChart chart = ChartFactory.createBarChart(null, null, null, createBarDataset(), PlotOrientation.VERTICAL,
			false, false, false);
	AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
	chart.setBackgroundPaint(null);
	chart.setBackgroundImageAlpha(0.0f);

	CategoryPlot plot = (CategoryPlot) chart.getPlot();
	plot.setRangeGridlinesVisible(false);
	plot.setDomainGridlinesVisible(false);
	plot.setOutlineVisible(false);
	plot.setRangeZeroBaselineVisible(false);
	plot.setDomainGridlinesVisible(false);
	plot.setBackgroundPaint(COLOR_INVISIBLE);
	plot.setBackgroundImageAlpha(0.0f);

	BarRenderer renderer = (BarRenderer) plot.getRenderer();
	renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NOMINAL));
	renderer.setBarPainter(new StandardBarPainter());
	renderer.setDrawBarOutline(true);
	renderer.setShadowVisible(false);

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

示例3: createBarChart

import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
@Override
protected JFreeChart createBarChart() throws JRException
{
	JFreeChart jfreeChart = super.createBarChart();

	CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
	//categoryPlot.setOrientation(PlotOrientation.HORIZONTAL);
	BarRenderer barRenderer = (BarRenderer)categoryPlot.getRenderer();
	barRenderer.setItemMargin(0);
	barRenderer.setGradientPaintTransformer(
		new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL)
		);
	CategoryDataset categoryDataset = categoryPlot.getDataset();
	if (categoryDataset != null)
	{
		for (int i = 0; i < categoryDataset.getRowCount(); i++)
		{
			barRenderer.setSeriesPaint(i, ChartThemesConstants.EYE_CANDY_SIXTIES_GRADIENT_PAINTS.get(i));
		}
	}
	return jfreeChart;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:EyeCandySixtiesChartTheme.java

示例4: createStackedBarChart

import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
@Override
protected JFreeChart createStackedBarChart() throws JRException
{
	JFreeChart jfreeChart = super.createStackedBarChart();

	CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
	//categoryPlot.setOrientation(PlotOrientation.HORIZONTAL);
	BarRenderer barRenderer = (BarRenderer)categoryPlot.getRenderer();
	barRenderer.setItemMargin(0);
	barRenderer.setGradientPaintTransformer(
		new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL)
		);

	CategoryDataset categoryDataset = categoryPlot.getDataset();
	if (categoryDataset != null)
	{
		for (int i = 0; i < categoryDataset.getRowCount(); i++)
		{
			barRenderer.setSeriesPaint(i, ChartThemesConstants.EYE_CANDY_SIXTIES_GRADIENT_PAINTS.get(i));
		}
	}
	return jfreeChart;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:24,代码来源:EyeCandySixtiesChartTheme.java

示例5: applyTo

import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
/**
 * Apply the chart style to the chart passed as parameter.
 *
 * @param chart the chart to apply the style to (is modified by the method)
 * @param dataset the dataset associated with the chart
 */
public void applyTo(JFreeChart chart, final DefaultCategoryDataset dataset) {
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setBarPainter(new StandardBarPainter());
    renderer.setDrawBarOutline(false);
    renderer.setShadowVisible(false);
    int seriesCount = dataset.getRowCount();
    int coloursSize = colours.size();
    int colourMod;
    for (int series = 0; series < seriesCount; series++) {
        colourMod = series % coloursSize;
        renderer.setSeriesPaint(series, this.colours.get(colourMod));
    }

}
 
开发者ID:c2mon,项目名称:c2mon-web-ui,代码行数:22,代码来源:BarChartStyle.java

示例6: createChart

import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
private JFreeChart createChart(CategoryDataset dataset, HttpServletRequest request) {
    JFreeChart chart = ChartFactory.createBarChart(null, null, null, dataset, PlotOrientation.HORIZONTAL, false, false, false);

    CategoryPlot plot = chart.getCategoryPlot();
    Paint background = new GradientPaint(0, 0, Color.lightGray, 0, IMAGE_MIN_HEIGHT, Color.white);
    plot.setBackgroundPaint(background);
    plot.setDomainGridlinePaint(Color.white);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    LogarithmicAxis rangeAxis = new LogarithmicAxis(null);
    rangeAxis.setStrictValuesFlag(false);
    rangeAxis.setAllowNegativesFlag(true);
    plot.setRangeAxis(rangeAxis);

    // Disable bar outlines.
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);

    // Set up gradient paint for series.
    GradientPaint gp0 = new GradientPaint(
            0.0f, 0.0f, Color.blue,
            0.0f, 0.0f, new Color(0, 0, 64)
    );
    renderer.setSeriesPaint(0, gp0);

    // Rotate labels.
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));

    // Set theme-specific colors.
    Color bgColor = getBackground(request);
    Color fgColor = getForeground(request);

    chart.setBackgroundPaint(bgColor);

    domainAxis.setTickLabelPaint(fgColor);
    domainAxis.setTickMarkPaint(fgColor);
    domainAxis.setAxisLinePaint(fgColor);

    rangeAxis.setTickLabelPaint(fgColor);
    rangeAxis.setTickMarkPaint(fgColor);
    rangeAxis.setAxisLinePaint(fgColor);

    return chart;
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:48,代码来源:UserChartController.java

示例7: createHourlyBreakageDistributionChart

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

示例8: createDayOfWeekBreakageDistributionChart

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

示例9: setBarPlotColours

import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
public static void setBarPlotColours(JFreeChart chart, int numberOfSections, Color baseColor) {
    Color color = baseColor;
    BarRenderer renderer = (BarRenderer) ((CategoryPlot) chart.getPlot()).getRenderer();
    renderer.setBarPainter(new StandardBarPainter());
    for (int i = 0; i < numberOfSections; i++) {
        renderer.setSeriesPaint(i, color);
        color = darken(color);
    }
}
 
开发者ID:IARC-CSU,项目名称:CanReg5,代码行数:10,代码来源:Tools.java

示例10: customize

import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
@Override
public void customize(JFreeChart chart, JRChart jasperChart)
{
	BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer();
	renderer.setSeriesPaint(0, Color.green);
	renderer.setSeriesPaint(1, Color.orange);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:8,代码来源:BarChartCustomizer.java

示例11: createChart

import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
/**
 * Creates a chart.
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {
    
    JFreeChart chart = ChartFactory.createBarChart(
        "",  // chart title
        "�rea",
        "Valor",
        dataset,             // data
        PlotOrientation.VERTICAL,
        true,
        false,
        false
    );
    
    

    CategoryPlot  plot = (CategoryPlot) chart.getPlot();
    plot.setNoDataMessage("No hay informaci�n disponible");
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.black);
    plot.setRangeGridlinePaint(Color.black);
    
    ((BarRenderer) plot.getRenderer()).setBarPainter(new StandardBarPainter());
    final BarRenderer renderer = (BarRenderer) plot.getRenderer();        
    renderer.setDrawBarOutline(false);
    
    
    renderer.setSeriesPaint(1, new Color(255,255,0));
    renderer.setSeriesPaint(2, new Color(11,70,119));
    renderer.setSeriesPaint(3, new Color(143,195,19));
    renderer.setSeriesPaint(4, new Color(255,0,0));
    
    return chart;
    
}
 
开发者ID:luislaredovelazquez,项目名称:ERP-en-Java,代码行数:42,代码来源:panelEjemplo.java

示例12: setBarColors

import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
/**
 * This method sets the Colors for a bar chart with two series. It ONLY applies to bar charts
 * @param plot
 * @param aColorRange an <code>array</code> of <code>Color</code>s, where each color will be assigned to a consequetive series.
 */
private void setBarColors(final CategoryPlot plot, final Color[] aColorRange) {
    final BarRenderer renderer = (BarRenderer) plot.getRenderer();
    for (int i = 0; i < aColorRange.length; i++) {
        renderer.setSeriesPaint(i, aColorRange[i]);
    }
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:12,代码来源:ChartPostProcessorImpl.java

示例13: createNominalChart

import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的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.renderer.category.BarRenderer; //导入方法依赖的package包/类
/**
 * Creates a sample chart.
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {
    
    // create the chart...
    JFreeChart chart = ChartFactory.createBarChart(
        "Bar Chart Demo 1",       // chart title
        "Category",               // domain axis label
        "Value",                  // range axis label
        dataset,                  // data
        PlotOrientation.VERTICAL, // orientation
        true,                     // include legend
        true,                     // tooltips?
        false                     // URLs?
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

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

    // get a reference to the plot for further customisation...
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);

    // ******************************************************************
    //  More than 150 demo applications are included with the JFreeChart
    //  Developer Guide...for more information, see:
    //
    //  >   http://www.object-refinery.com/jfreechart/guide.html
    //
    // ******************************************************************
    
    // set the range axis to display integers only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // disable bar outlines...
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    
    // set up gradient paints for series...
    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 
            0.0f, 0.0f, new Color(0, 0, 64));
    GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 
            0.0f, 0.0f, new Color(0, 64, 0));
    GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 
            0.0f, 0.0f, new Color(64, 0, 0));
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(
            CategoryLabelPositions.createUpRotationLabelPositions(
                    Math.PI / 6.0));
    // OPTIONAL CUSTOMISATION COMPLETED.
    
    return chart;
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:70,代码来源:BarChartDemo1.java

示例15: createBuildResultsBarChart

import org.jfree.chart.renderer.category.BarRenderer; //导入方法依赖的package包/类
/**
 * Creates a distribution image for build results.
 *
 * @param stats         SortedMap with dates as keys and
 *                      BuildStatistics as value.
 * @param categoryLabel - label to place on X axis.
 * @param out           OutputStream to write image to.
 */
public static void createBuildResultsBarChart(final SortedMap stats, final String categoryLabel,
                                              final String dateFormat, 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 Date date = (Date) entry.getKey();
    final BuildStatistics bst = (BuildStatistics) entry.getValue();
    final String dateAsString = StringUtils.formatDate(date, dateFormat);
    dataset.addValue(new Integer(bst.getFailedBuilds()), "Failed builds", dateAsString);
    dataset.addValue(new Integer(bst.getSuccessfulBuilds()), "Successful builds", dateAsString);
  }

  // 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());

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

  // 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
  bar.setSeriesPaint(1, Color.GREEN); // second bar
  //plot.setRenderer(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,代码行数:52,代码来源:StatisticsUtils.java


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