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

项目:rapidminer    文件:ChartRendererFactory.java   
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);
}
项目:rapidminer    文件:NominalAttributeStatisticsModel.java   
/**
 * 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;
}
项目:ccu-historian    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:jfreechart    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme ({@code null} not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtils#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    Args.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:aya-lang    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:c2mon-web-ui    文件:BarChartStyle.java   
/**
 * 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));
    }

}
项目:iBioSim    文件:GraphData.java   
public GraphData(String printer_id, String outDir, boolean warn, String label,String yLabel, ArrayList<String> learnSpecs) {
    this.outDir = outDir;
    this.printer_id = printer_id;
    this.warn = warn;
    this.learnSpecs = learnSpecs;
    graphProbs = new ArrayList<String>();
    probGraphed = new LinkedList<GraphProbs>();
    chart = ChartFactory.createBarChart(label, "", yLabel, new DefaultCategoryDataset(), PlotOrientation.VERTICAL, true, true, false);
    applyChartTheme();
    ((BarRenderer) chart.getCategoryPlot().getRenderer()).setBarPainter(new StandardBarPainter());
    chart.setBackgroundPaint(new java.awt.Color(238, 238, 238));
    chart.getPlot().setBackgroundPaint(java.awt.Color.WHITE);
    chart.getCategoryPlot().setRangeGridlinePaint(java.awt.Color.LIGHT_GRAY);
    legend = chart.getLegend();
    timeSeriesPlot = false;
    averageOrder = null;
}
项目:rapidminer-studio    文件:ChartRendererFactory.java   
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);
}
项目:rapidminer-studio    文件:NominalAttributeStatisticsModel.java   
/**
 * 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;
}
项目:populus    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:Benchmark    文件:ScatterPlot.java   
public static StandardChartTheme initializeTheme() {
    String fontName = "Arial";
    StandardChartTheme theme = (StandardChartTheme) org.jfree.chart.StandardChartTheme.createJFreeTheme();
    theme.setExtraLargeFont(new Font(fontName, Font.PLAIN, 24)); // title
    theme.setLargeFont(new Font(fontName, Font.PLAIN, 20)); // axis-title
    theme.setRegularFont(new Font(fontName, Font.PLAIN, 16));
    theme.setSmallFont(new Font(fontName, Font.PLAIN, 12));
    theme.setRangeGridlinePaint(Color.decode("#C0C0C0"));
    theme.setPlotBackgroundPaint(Color.white);
    theme.setChartBackgroundPaint(Color.white);
    theme.setGridBandPaint(Color.red);
    theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
    theme.setBarPainter(new StandardBarPainter());
    theme.setAxisLabelPaint(Color.decode("#666666"));
    return theme;
}
项目:PI    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    if (theme == null) {
        throw new IllegalArgumentException("Null 'theme' argument.");
    }
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:gama    文件:ChartJFreeChartOutputHistogram.java   
public static void enableFlatLook(final boolean flat) {
    if (flat) {
        BarRenderer.setDefaultBarPainter(new StandardBarPainter());
        BarRenderer.setDefaultShadowsVisible(false);
        XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        XYBarRenderer.setDefaultShadowsVisible(false);
        StackedBarRenderer.setDefaultBarPainter(new StandardBarPainter());
        StackedBarRenderer.setDefaultShadowsVisible(false);
    } else {
        BarRenderer.setDefaultBarPainter(new GradientBarPainter());
        BarRenderer.setDefaultShadowsVisible(true);
        XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        XYBarRenderer.setDefaultShadowsVisible(true);
        StackedBarRenderer.setDefaultBarPainter(new GradientBarPainter());
        StackedBarRenderer.setDefaultShadowsVisible(true);
    }
}
项目:swing    文件:SectorProfileChartPanel.java   
private void configureBarRenderer(BarRenderer barRenderer) {
    barRenderer.setBarPainter(new StandardBarPainter());
    barRenderer.setSeriesPaint(0, Color.black);
    barRenderer.setSeriesPaint(1, Color.blue);
    barRenderer.setSeriesPaint(2, Color.cyan);
    barRenderer.setSeriesPaint(3, Color.darkGray);
    barRenderer.setSeriesPaint(4, Color.gray);
    barRenderer.setSeriesPaint(5, Color.green);
    barRenderer.setSeriesPaint(6, Color.lightGray);
    barRenderer.setSeriesPaint(7, Color.magenta);
    barRenderer.setSeriesPaint(8, Color.orange);
    barRenderer.setSeriesPaint(9, Color.red);
    barRenderer.setDrawBarOutline(false);
    barRenderer.setShadowVisible(false);
    barRenderer.setBaseItemLabelGenerator(sectorProfileLabelGenerator);
    barRenderer.setBaseItemLabelsVisible(true);
}
项目:ECG-Viewer    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:astor    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    if (theme == null) {
        throw new IllegalArgumentException("Null 'theme' argument.");
    }
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:conqat    文件:BulletChartCreator.java   
/** Customize renderer. */
private void customizeRenderer(CategoryPlot plot) {
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setMaximumBarWidth(0.5);
    renderer.setSeriesPaint(0, Color.BLACK);

    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);
    renderer.setBaseItemLabelPaint(Color.white);
    renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(
            ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER,
            0.0));

    renderer.setBarPainter(new StandardBarPainter());
    renderer.setShadowVisible(false);
}
项目:AMOS_proj5    文件:ChartRenderer.java   
/**
 * Creates chart (JFreeChart object) from dataset. Is used when Chart Type "Location-Format" or "Format-Location" is selected.
 * 
 * @param collection Collection that provides all data that should be displayed.
 * @param unit Unit: kWh or kWh/TNF
 * @return Returns finished JFreeChart object.
 */
private JFreeChart createLocationFormatChart(DefaultCategoryDataset collection,String unit){

    JFreeChart barChart = ChartFactory.createBarChart("Production Consumption","",
            ("1".equals(unit)?"Energy Consumption [kWh]":("2".equals(unit)?"Energy Consumption [kWh/TNF]":("3".equals(unit)?"Produced Pieces [TNF]":""))),
            collection, PlotOrientation.VERTICAL, true, true, false);

    //graphical modifications for BarChart
    barChart.setBackgroundPaint(Color.white);
    CategoryPlot plot = barChart.getCategoryPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
    plot.setShadowGenerator(null);

    //Barmodifications
    BarRenderer renderer=(BarRenderer) plot.getRenderer();
    renderer.setBarPainter(new StandardBarPainter());
    renderer.setItemMargin(0);
    renderer.setShadowVisible(false);
    plot.setRenderer(renderer);

    return barChart;

}
项目:group-five    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:manydesigns.cn    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:rapidminer-5    文件:ChartRendererFactory.java   
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);
}
项目:aorra    文件:MarineBarChart.java   
public Drawable createChart(ADCDataset dataset) {
  final JFreeChart chart = ChartFactory.createBarChart(
      dataset.get(Attribute.TITLE),
      dataset.get(Attribute.X_AXIS_LABEL),
      dataset.get(Attribute.Y_AXIS_LABEL),
      dataset,
      PlotOrientation.VERTICAL,
      true, false, false);
  final CategoryPlot plot = chart.getCategoryPlot();
  plot.setBackgroundPaint(Color.white);
  plot.setDomainGridlinePaint(Color.lightGray);
  plot.setRangeGridlinePaint(Color.lightGray);
  ValueAxis raxis = plot.getRangeAxis();
  raxis.setRange(0, 100.0);
  CategoryAxis cAxis = plot.getDomainAxis();
  cAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
  BarRenderer renderer = (BarRenderer)plot.getRenderer();
  renderer.setSeriesPaint(0, Colors.fromHex("#0AA1D8"));
  renderer.setSeriesPaint(1, Colors.fromHex("#932832"));
  renderer.setSeriesPaint(2, Colors.fromHex("#94BA4D"));
  renderer.setBarPainter(new StandardBarPainter());
  renderer.setItemMargin(0.01);
  return new JFreeChartDrawable(chart, new Dimension(750, 500));
}
项目:aorra    文件:WetlandsRemaing.java   
public static Drawable createChart(ADCDataset dataset, Dimension dimension) {
    final JFreeChart chart = ChartFactory.createBarChart(
            dataset.get(Attribute.TITLE),// chart title
            dataset.get(Attribute.X_AXIS_LABEL),// domain axis label
            dataset.get(Attribute.Y_AXIS_LABEL),// range axis label
            dataset,                  // data
            PlotOrientation.VERTICAL, // orientation
            true,                    // include legend
            false,                     // tooltips?
            false                     // URLs?
        );
    chart.setBackgroundPaint(Color.white);
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);
    final BarRenderer renderer = (BarRenderer)plot.getRenderer();
    Colors.setSeriesPaint(renderer, dataset.get(Attribute.SERIES_COLORS));
    renderer.setItemMargin(0);
    renderer.setBarPainter(new StandardBarPainter());
    final CategoryAxis cAxis = plot.getDomainAxis();
    cAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    chart.getTitle().setFont(cAxis.getLabelFont());
    chart.getLegend().setMargin(2, 60, 2, 20);
    return new JFreeChartDrawable(chart, dimension);
}
项目:aorra    文件:RiparianFL.java   
public static Drawable createChart(ADCDataset dataset, Dimension dimension) {
    final JFreeChart chart = ChartFactory.createBarChart(
            dataset.get(Attribute.TITLE),        // chart title
            dataset.get(Attribute.X_AXIS_LABEL), // domain axis label
            dataset.get(Attribute.Y_AXIS_LABEL),// range axis label
            dataset,                  // data
            PlotOrientation.VERTICAL, // orientation
            true,                    // include legend
            false,                     // tooltips?
            false                     // URLs?
        );
    chart.setBackgroundPaint(Color.white);
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);
    final BarRenderer renderer = (BarRenderer)plot.getRenderer();
    Colors.setSeriesPaint(renderer, dataset.get(Attribute.SERIES_COLORS));
    renderer.setItemMargin(0);
    renderer.setBarPainter(new StandardBarPainter());
    final CategoryAxis cAxis = plot.getDomainAxis();
    cAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    return new JFreeChartDrawable(chart, dimension);
}
项目:buffer_bci    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:buffer_bci    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:proyecto-teoria-control-utn-frro    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:Memetic-Algorithm-for-TSP    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:iveely.ml    文件:ChartUtils.java   
public static void setChartTheme() {
    StandardChartTheme chartTheme = new StandardChartTheme("CN");
    chartTheme.setExtraLargeFont(FONT);
    chartTheme.setRegularFont(FONT);
    chartTheme.setLargeFont(FONT);
    chartTheme.setSmallFont(FONT);
    chartTheme.setTitlePaint(new Color(51, 51, 51));
    chartTheme.setSubtitlePaint(new Color(85, 85, 85));

    chartTheme.setLegendBackgroundPaint(Color.WHITE);
    chartTheme.setLegendItemPaint(Color.BLACK);//
    chartTheme.setChartBackgroundPaint(Color.WHITE);

    Paint[] OUTLINE_PAINT_SEQUENCE = new Paint[]{Color.WHITE};
    DefaultDrawingSupplier drawingSupplier = new DefaultDrawingSupplier(CHART_COLORS, CHART_COLORS, OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);
    chartTheme.setDrawingSupplier(drawingSupplier);

    chartTheme.setPlotBackgroundPaint(Color.WHITE);
    chartTheme.setPlotOutlinePaint(Color.WHITE);
    chartTheme.setLabelLinkPaint(new Color(8, 55, 114));
    chartTheme.setLabelLinkStyle(PieLabelLinkStyle.CUBIC_CURVE);

    chartTheme.setAxisOffset(new RectangleInsets(5, 12, 5, 12));
    chartTheme.setDomainGridlinePaint(new Color(192, 208, 224));
    chartTheme.setRangeGridlinePaint(new Color(192, 192, 192));

    chartTheme.setBaselinePaint(Color.WHITE);
    chartTheme.setCrosshairPaint(Color.BLUE);
    chartTheme.setAxisLabelPaint(new Color(51, 51, 51));
    chartTheme.setTickLabelPaint(new Color(67, 67, 72));
    chartTheme.setBarPainter(new StandardBarPainter());
    chartTheme.setXYBarPainter(new StandardXYBarPainter());

    chartTheme.setItemLabelPaint(Color.black);
    chartTheme.setThermometerPaint(Color.white);

    ChartFactory.setChartTheme(chartTheme);
}
项目:ojAlgo-extensions    文件:StackedBarChartBuilder.java   
@Override
protected Plot makePlot(final JFreeChartBuilder.PlotParameters parameters) {

    final DefaultKeyedValues2DDataset tmpDataset = this.getDataset();

    final CategoryAxis tmpCategoryAxis = this.makeCategoryAxis(domain);

    final ValueAxis tmpValueAxis = this.makeValueAxis(range);

    final StackedBarRenderer tmpRenderer = new StackedBarRenderer();
    tmpRenderer.setBarPainter(new StandardBarPainter());
    tmpRenderer.setShadowVisible(false);

    if (this.isTooltips()) {
        tmpRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (this.isUrls()) {
        tmpRenderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    this.setColours(tmpRenderer, tmpDataset);

    final CategoryPlot retVal = new CategoryPlot(tmpDataset, tmpCategoryAxis, tmpValueAxis, tmpRenderer);
    retVal.setOrientation(parameters.getOrientation());
    retVal.setBackgroundPaint(parameters.getBackground());
    retVal.setOutlinePaint(parameters.getOutline());

    return retVal;
}
项目:ojAlgo-extensions    文件:BarChartBuilder.java   
@Override
protected Plot makePlot(final JFreeChartBuilder.PlotParameters parameters) {

    final DefaultKeyedValues2DDataset tmpDataset = this.getDataset();

    final CategoryAxis tmpCategoryAxis = this.makeCategoryAxis(domain);

    final NumberAxis tmpValueAxis = this.makeValueAxis(range);

    final BarRenderer tmpRenderer = new BarRenderer();
    tmpRenderer.setBarPainter(new StandardBarPainter());
    tmpRenderer.setShadowVisible(false);
    if (this.isTooltips()) {
        tmpRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (this.isUrls()) {
        tmpRenderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    this.setColours(tmpRenderer, tmpDataset);

    final CategoryPlot retVal = new CategoryPlot(tmpDataset, tmpCategoryAxis, tmpValueAxis, tmpRenderer);
    retVal.setOrientation(parameters.getOrientation());
    retVal.setBackgroundPaint(parameters.getBackground());
    retVal.setOutlinePaint(parameters.getOutline());

    return retVal;
}
项目:CanReg5    文件:Tools.java   
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);
    }
}
项目:AweSheet    文件:BarChart.java   
@Override
public boolean generateImageData() {
    // Create the dataset.
    DefaultCategoryDataset dataset = createDataset();

    if (dataset == null) {
        return false;
    }

    // Create the chart.
    JFreeChart barChart = ChartFactory.createBarChart(
            title,
            nameX, nameY,
            dataset, PlotOrientation.VERTICAL,
            true, true, false);

    final CategoryPlot plot = barChart.getCategoryPlot();
    ((BarRenderer) plot.getRenderer()).setBarPainter(new StandardBarPainter());

    // Generate the image.
    try {
        imageData = ChartUtilities.encodeAsPNG(barChart.createBufferedImage(720, 480));
    } catch (IOException e) {
        return false;
    }

    return true;
}
项目:ERP-en-Java    文件:panelEjemplo.java   
/**
 * 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;

}
项目:fhaes    文件:ColorBarGraph.java   
/**
 * Creates the chart with the data from the given data set.
 * 
 * @param dataset the data to plot.
 * @return the chart.
 */
private static JFreeChart createChart(final CategoryDataset dataset) {

    final JFreeChart chart = ChartFactory.createStackedBarChart("", "", "", dataset, PlotOrientation.VERTICAL, false, true, false);

    StackedBarRenderer renderer = new StackedBarRenderer(true);
    renderer.setShadowVisible(false);
    renderer.setBarPainter(new StandardBarPainter()); // Remove shine
    renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRenderer(renderer);

    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(new Color(192, 192, 192));

    plot.getDomainAxis().setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.getDomainAxis().setVisible(false);
    plot.getRangeAxis().setVisible(false);
    plot.getDomainAxis().setLowerMargin(.025);
    plot.getDomainAxis().setUpperMargin(.025);

    chart.setBackgroundPaint(new Color(214, 217, 233, 30));

    return chart;
}
项目:fhaes    文件:ColorBar.java   
/**
 * Creates a chart when given a data set.
 * 
 * @param dataset to be plotted.
 * @return the created chart.
 */
private static JFreeChart createChart(final CategoryDataset dataset) {

    final JFreeChart chart = ChartFactory.createStackedBarChart("", "", "", dataset, PlotOrientation.HORIZONTAL, false, true, false);

    chart.setPadding(RectangleInsets.ZERO_INSETS);
    chart.setBorderVisible(false);

    StackedBarRenderer renderer = new StackedBarRenderer();
    renderer.setBarPainter(new StandardBarPainter()); // Remove shine
    renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    renderer.setShadowVisible(false);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRenderer(renderer);
    // plot.setBackgroundAlpha(0.0f);

    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);

    plot.getRangeAxis().setVisible(false);
    plot.getRangeAxis().setLowerMargin(0);
    plot.getRangeAxis().setUpperMargin(0);

    plot.getDomainAxis().setVisible(false);
    plot.getDomainAxis().setLowerMargin(0);
    plot.getDomainAxis().setUpperMargin(0);

    return chart;
}
项目:entity-system-benchmarks    文件:ChartWriterFactory.java   
private static void notSoUglyPlease(JFreeChart chart) {
    String fontName = "Lucida Sans";

    StandardChartTheme theme = (StandardChartTheme)org.jfree.chart.StandardChartTheme.createJFreeTheme();

    theme.setTitlePaint( Color.decode("#4572a7") );
    theme.setExtraLargeFont(new Font(fontName, Font.BOLD, 14)); //title
    theme.setLargeFont(new Font(fontName, Font.BOLD, 15)); //axis-title
    theme.setRegularFont(new Font(fontName, Font.PLAIN, 11));
    theme.setRangeGridlinePaint(Color.decode("#C0C0C0"));
    theme.setPlotBackgroundPaint(Color.white);
    theme.setChartBackgroundPaint(Color.white);
    theme.setGridBandPaint(Color.red);
    theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
    theme.setBarPainter(new StandardBarPainter());
    theme.setAxisLabelPaint(Color.decode("#666666"));
    theme.apply(chart);
    chart.getCategoryPlot().setOutlineVisible(false);
    chart.getCategoryPlot().getRangeAxis().setAxisLineVisible(false);
    chart.getCategoryPlot().getRangeAxis().setTickMarksVisible(false);
    chart.getCategoryPlot().setRangeGridlineStroke(new BasicStroke());
    chart.getCategoryPlot().getRangeAxis().setTickLabelPaint(Color.decode("#666666"));
    chart.getCategoryPlot().getDomainAxis().setTickLabelPaint(Color.decode("#666666"));
    chart.setTextAntiAlias(true);
    chart.setAntiAlias(true);
    BarRenderer rend = (BarRenderer) chart.getCategoryPlot().getRenderer();
    rend.setShadowVisible(true);
    rend.setShadowXOffset(2);
    rend.setShadowYOffset(0);
    rend.setShadowPaint(Color.decode("#C0C0C0"));
    rend.setMaximumBarWidth(0.1);
}
项目:astor    文件:StandardBarPainterTests.java   
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashcode() {
    StandardBarPainter p1 = new StandardBarPainter();
    StandardBarPainter p2 = new StandardBarPainter();
    assertTrue(p1.equals(p2));
    int h1 = p1.hashCode();
    int h2 = p2.hashCode();
    assertEquals(h1, h2);
}
项目:conqat    文件:RangeDistributionBarChartCreator.java   
/** Configure renderer. */
private void configureRenderer(CategoryPlot plot) {
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setMaximumBarWidth(0.5);
    renderer.setSeriesPaint(0, Color.BLACK);

    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);
    renderer.setBaseItemLabelPaint(Color.white);
    renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(
            ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER,
            0.0));
    renderer.setBaseItemLabelFont(EHtmlPresentationFont.SANS_CONDENSED
            .getFont());

    for (AssessmentRange range : ranges) {
        int index = plot.getDataset().getRowIndex(range);
        renderer.setSeriesPaint(index, range.getColor());
        if (obtainGrayLevel(range.getColor()) > 128) {
            // use black label color on bright bar, e.g. yellow
            renderer.setSeriesItemLabelPaint(index, Color.black);
        }
    }

    if (!showAbsoluteValues) {
        renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(
                "{2}", NumberFormat.getPercentInstance()));
    }

    renderer.setBarPainter(new StandardBarPainter());
    renderer.setShadowVisible(false);
}
项目:jClipCorn    文件:StatisticsOnlinescoreChart.java   
@Override
protected JFreeChart createChart(CCMovieList movielist, StatisticsTypeFilter source) {
    JFreeChart chart = ChartFactory.createBarChart(
            "",      //$NON-NLS-1$
            "",      //$NON-NLS-1$
            "",      //$NON-NLS-1$
            getDataSet(movielist, source),               
            PlotOrientation.VERTICAL, 
            false,                  
            false,
            false
    );

    chart.removeLegend();

    CategoryPlot plot = chart.getCategoryPlot();

    BarRenderer renderer = new BarRenderer();
    renderer.setSeriesPaint(0, BARCHART_COLOR);
    renderer.setBarPainter(new StandardBarPainter());
    plot.setRenderer(renderer);

    plot.setBackgroundPaint(XYBACKGROUND_COLOR);
    plot.setDomainGridlinePaint(GRIDLINECOLOR);
    plot.setRangeGridlinePaint(GRIDLINECOLOR);

    chart.setBackgroundPaint(null);
    plot.getDomainAxis().setTickLabelPaint(TEXT_FOREGROUND);
    plot.getRangeAxis().setTickLabelPaint(TEXT_FOREGROUND);

    return chart;
}