Example usage for org.jfree.chart.renderer.category BarRenderer setSeriesOutlinePaint

List of usage examples for org.jfree.chart.renderer.category BarRenderer setSeriesOutlinePaint

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.category BarRenderer setSeriesOutlinePaint.

Prototype

public void setSeriesOutlinePaint(int series, Paint paint) 

Source Link

Document

Sets the paint used for a series outline and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:net.imglib2.script.analysis.BarChart.java

static private final void setBarTheme(final JFreeChart chart) {
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setSeriesOutlinePaint(0, Color.lightGray);
    renderer.setShadowVisible(false);/* w  w w  .  ja  v  a 2s  . co  m*/
    renderer.setDrawBarOutline(true);
    setBackgroundDefault(chart);
}

From source file:com.hmsinc.epicenter.webapp.chart.ChartService.java

/**
 * @param chart/*from   w  ww .  j  a  v a 2s  . co m*/
 * @return
 */
private static CategoryItemRenderer getBarRenderer(final AbstractChart chart) {

    final BarRenderer renderer = new BarRenderer();
    renderer.setMaximumBarWidth(0.3);

    for (int i = 0; i < chart.getColors().size(); i++) {

        final Color c = chart.getColors().get(i);
        renderer.setSeriesPaint(i, new GradientPaint(0f, 0f, c, 0f, 0f, c.brighter().brighter()));
        renderer.setSeriesOutlinePaint(i, c);

    }

    return renderer;
}

From source file:org.matsim.counts.algorithms.graphs.CountsLoadCurveGraph.java

@Override
public JFreeChart createChart(final int nbr) {
    String title = this.getChartTitle() + ", Iteration: " + this.iteration_;
    this.chart_ = ChartFactory.createBarChart(title, "Hour", "Volumes [veh/h]", this.dataset0,
            PlotOrientation.VERTICAL, true, // legend?
            true, // tooltips?
            false // URLs?
    );/*from   w  w w . j a  v a 2  s .  co m*/
    CategoryPlot plot = this.chart_.getCategoryPlot();
    //      plot.getRangeAxis().setRange(0.0, 10000.0); // do not set a fixed range for the single link graphs
    plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);

    // BarRenderer renderer=(BarRenderer) plot.getRenderer();
    BarRenderer renderer = new BarRenderer();
    renderer.setSeriesOutlinePaint(0, Color.black);
    renderer.setSeriesOutlinePaint(1, Color.black);
    renderer.setSeriesPaint(0, Color.getHSBColor((float) 0.62, (float) 0.56, (float) 0.93));
    // Color.orange gives a dirty yellow!
    renderer.setSeriesPaint(1, Color.getHSBColor((float) 0.1, (float) 0.79, (float) 0.89));
    renderer.setSeriesToolTipGenerator(0, new StandardCategoryToolTipGenerator());
    renderer.setSeriesToolTipGenerator(1, new StandardCategoryToolTipGenerator());
    renderer.setItemMargin(0.0);

    // configure plot with light colors instead of the default 3D
    renderer.setShadowVisible(false);
    renderer.setBarPainter(new StandardBarPainter());
    this.chart_.setBackgroundPaint(Color.getHSBColor((float) 0.0, (float) 0.0, (float) 0.93));
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.gray);
    plot.setRangeGridlinesVisible(true);

    plot.setRenderer(0, renderer);
    plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    // TRRE:  plot.setDataset(1, this.dataset1);
    plot.mapDatasetToRangeAxis(1, 1);

    final CategoryAxis axis1 = plot.getDomainAxis();
    axis1.setCategoryMargin(0.25); // leave a gap of 25% between categories

    /*  TRRE: 
    final ValueAxis axis2 = new NumberAxis("Signed Rel. Error [%]");
    plot.setRangeAxis(1, axis2);
            
    final LineAndShapeRenderer renderer2 = new LineAndShapeRenderer();
    renderer2.setSeriesToolTipGenerator(0, new StandardCategoryToolTipGenerator());
    renderer2.setSeriesShape(0, new Rectangle2D.Double(-1.5, -1.5, 3.0, 3.0));
    renderer2.setSeriesPaint(0, Color.black);
    renderer2.setBaseStroke(new BasicStroke(2.5f));
    plot.setRenderer(1, renderer2);
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    */

    return this.chart_;
}

From source file:moller.javapeg.program.gui.frames.ImageRepositoryStatisticsViewer.java

private ChartPanel createChart(CategoryDataset bardataset, String label) {
    String title = getLang().get("imagestatisticsviewer.chart.title.prefix");
    String valueAxisLabel = getLang().get("imagestatisticsviewer.chart.valueAxisLabel");

    JFreeChart barChart = ChartFactory.createBarChart(title + " " + label, label, valueAxisLabel, bardataset);

    ChartPanel chartPanel = new ChartPanel(barChart);
    chartPanel.setName(label);// www. j  ava2 s  . co m
    chartPanel.setMouseWheelEnabled(true);

    final CategoryPlot plot = barChart.getCategoryPlot();
    plot.setBackgroundPaint(new Color(204, 204, 204));

    BarRenderer barRenderer = (BarRenderer) plot.getRenderer();
    barRenderer.setBarPainter(new StandardBarPainter());
    barRenderer.setSeriesPaint(0, new Color(102, 153, 204));
    barRenderer.setDrawBarOutline(true);
    barRenderer.setSeriesOutlinePaint(0, Color.BLACK);

    return chartPanel;
}

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.ChartRendererFactory.java

private static void configureBarRenderer(BarRenderer renderer, ValueSource valueSource,
        PlotInstance plotInstance) {// www  . ja  v a 2  s. c om
    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);
}

From source file:net.sqs2.omr.result.export.chart.ChartImageWriter.java

private void setSectionPaint(DefaultCategoryDataset dataSet, CategoryPlot plot) {

    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(true);//from  w w w  .  j ava  2 s. co m
    renderer.setItemLabelAnchorOffset(10);

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    if (this.itemBackgroundImages != null && 0 < this.itemBackgroundImages.length) {
        int index = 0;
        Paint outlinePaint = Color.BLACK;
        Stroke outlineStroke = new BasicStroke(1.0f);
        for (@SuppressWarnings("unused")
        Object key : dataSet.getColumnKeys()) {
            int imageIndex = index % this.itemBackgroundImages.length;
            BufferedImage texture = this.itemBackgroundImages[imageIndex];
            Rectangle2D anchor = new Rectangle2D.Double(0, 0, texture.getWidth(), texture.getHeight());
            TexturePaint fillPaint = new TexturePaint(texture, anchor);
            renderer.setSeriesFillPaint(index, fillPaint);
            renderer.setSeriesPaint(index, fillPaint);
            renderer.setSeriesOutlinePaint(index, outlinePaint);
            renderer.setSeriesOutlineStroke(index, outlineStroke);

            // renderer.setBasePaint(fillPaint);
            // renderer.setBaseOutlineStroke(outlineStroke);
            // renderer.setBaseOutlinePaint(outlinePaint);
        }

    }
}

From source file:org.matsim.counts.algorithms.graphs.CountsGEHCurveGraph.java

@Override
public JFreeChart createChart(final int nbr) {
    String title = this.getChartTitle() + ", Iteration: " + this.iteration_;
    this.chart_ = ChartFactory.createBarChart(title, "Hour", "GEH", this.dataset, PlotOrientation.VERTICAL,
            false, // legend?
            false, // tooltips?
            false // URLs?
    );/*from   w w w .  java2 s  . co  m*/
    CategoryPlot plot = this.chart_.getCategoryPlot();
    //      plot.getRangeAxis().setRange(0.0, 10000.0); // do not set a fixed range for the single link graphs
    plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);

    // BarRenderer renderer=(BarRenderer) plot.getRenderer();
    //      BarRenderer renderer = new BarRenderer();
    /*
     * Chooses the color adaptive based on the value to be shown by a bar.
     * Values <= 5.0 are green, values >= 10 are red. In between the color is interpolated. 
     */
    BarRenderer renderer = new BarRenderer() {
        @Override
        public Paint getItemPaint(final int row, final int column) {
            double value = dataset.getValue(row, column).doubleValue();

            if (value <= 5.0)
                return Color.green;
            else if (value >= 10)
                return Color.red;
            else {
                if (value < 7.5) {
                    int mixed = mix(Color.yellow.getRGB(), Color.green.getRGB(), (7.5 - value) / 2.5);
                    return new Color(mixed);
                } else {
                    int mixed = mix(Color.red.getRGB(), Color.yellow.getRGB(), (10.0 - value) / 2.5);
                    return new Color(mixed);
                }
            }

            //            if (value <= 5.0) return Color.green;
            //            else if (value >= 10) return Color.red;
            //            else {
            //               int mixed = mix(Color.red.getRGB(), Color.green.getRGB(), (10.0 - value) / 5.0);
            //               return new Color(mixed);
            //            }
        }
    };
    renderer.setSeriesOutlinePaint(0, Color.black);
    renderer.setSeriesPaint(0, Color.getHSBColor((float) 0.62, (float) 0.56, (float) 0.93));
    renderer.setSeriesToolTipGenerator(0, new StandardCategoryToolTipGenerator());
    renderer.setItemMargin(0.0);

    // configure plot with light colors instead of the default 3D
    renderer.setShadowVisible(false);
    renderer.setBarPainter(new StandardBarPainter());
    this.chart_.setBackgroundPaint(Color.getHSBColor((float) 0.0, (float) 0.0, (float) 0.93));
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.gray);
    plot.setRangeGridlinesVisible(true);

    plot.setRenderer(0, renderer);
    plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    plot.mapDatasetToRangeAxis(1, 1);

    final CategoryAxis axis1 = plot.getDomainAxis();
    axis1.setCategoryMargin(0.25); // leave a gap of 25% between categories

    return this.chart_;
}