Example usage for org.jfree.chart.renderer.category BarRenderer3D setShadowVisible

List of usage examples for org.jfree.chart.renderer.category BarRenderer3D setShadowVisible

Introduction

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

Prototype

public void setShadowVisible(boolean visible) 

Source Link

Document

Sets the flag that controls whether or not shadows are drawn by the renderer.

Usage

From source file:com.redhat.thermostat.byteman.plot.impl.TestPlotRenderer.java

void renderToFile(Collection<PlotRecord> records, String filename) throws Exception {
    DefaultCategoryDataset ds = new DefaultCategoryDataset();
    for (PlotRecord re : records) {
        Long label = re.getPeriodStart() + ((re.getPeriodEnd() - re.getPeriodStart()) / 2);
        ds.addValue(re.getValue(), re.getCategory(), label);
    }//from w  w  w .  j  a va 2s .co  m
    JFreeChart chart = ChartFactory.createStackedBarChart(EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, ds,
            PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(toColor("#FFFFFFFF"));
    plot.setBackgroundImageAlpha((float) 0.0d);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(toColor("#FFAAAAAA"));
    //        plot.getRangeAxis().setRange(new Range(ds.getMin(), ds.getMax() * 1.1));
    plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    //        plot.getRangeAxis().setLabel(cf.rangeAxisLabel);
    //        colorAxis(plot.getRangeAxis());
    //        colorAxis(plot.getDomainAxis());
    //        plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI * 0.12d));
    //        plot.getDomainAxis().setLowerMargin(cf.domainAxisLowerMargin);
    //        plot.getDomainAxis().setUpperMargin(cf.domainAxisUpperMargin);
    //        plot.getDomainAxis().setLabel(cf.domainAxisLabel);
    BarRenderer3D barrenderer = new StackedBarRenderer3D(16.0d, 12.0d);
    barrenderer.setSeriesPaint(0, toColor("#00FFFFFF"));
    barrenderer.setSeriesPaint(1, toColor("#BB669900"));
    barrenderer.setSeriesPaint(2, toColor("#BBFF8800"));
    barrenderer.setWallPaint(toColor("#FFEEEEEE"));
    //        barrenderer.setBaseItemLabelsVisible(cf.baseItemLabelsVisible);
    barrenderer.setShadowVisible(false);
    barrenderer.setItemMargin(0.0d);
    plot.setRenderer(barrenderer);
    plot.setOutlineVisible(false);

    chartToSvg(chart, 1024, 600, filename);
}

From source file:com.redhat.thermostat.byteman.chart.swing.SwingBarChart.java

private JFreeChart createChart(Collection<PlotRecord> records) {
    // data/*from   w w  w . j av  a  2 s  . c  om*/
    DefaultCategoryDataset ds = new DefaultCategoryDataset();
    for (PlotRecord re : records) {
        Long label = re.getPeriodStart() + ((re.getPeriodEnd() - re.getPeriodStart()) / 2);
        ds.addValue(re.getValue(), re.getCategory(), label);
    }
    // chart
    BarRenderer3D br = new StackedBarRenderer3D(cf.rendered3dXOffset, cf.rendered3dYOffset);
    ZoomablePlot plot = new ZoomablePlot(zm, ds, new CategoryAxis(), new NumberAxis(), br);
    plot.setOrientation(PlotOrientation.VERTICAL);
    JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, false);
    ChartFactory.getChartTheme().apply(chart);
    // renderer
    br.setSeriesPaint(0, toColor(cf.seriesPaint0));
    br.setSeriesPaint(1, toColor(cf.seriesPaint1));
    br.setSeriesPaint(2, toColor(cf.seriesPaint2));
    br.setSeriesPaint(3, toColor(cf.seriesPaint3));
    br.setSeriesPaint(4, toColor(cf.seriesPaint4));
    br.setSeriesPaint(5, toColor(cf.seriesPaint5));
    br.setWallPaint(toColor(cf.wallPaint));
    br.setBaseItemLabelsVisible(cf.baseItemLabelsVisible);
    br.setShadowVisible(cf.shadowVisible);
    br.setItemMargin(cf.itemMargin);
    // plot
    plot.setBackgroundPaint(toColor(cf.backgroundPaint));
    plot.setBackgroundImageAlpha((float) cf.backgroundImageAlpha);
    plot.setDomainGridlinesVisible(cf.domainGridlinesVisible);
    plot.setRangeGridlinePaint(toColor(cf.rangeGridlinePaint));
    //        plot.getRangeAxis().setRange(new Range(ds.getMin(), ds.getMax() * 1.1));
    plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    plot.getRangeAxis().setLabel(cf.rangeAxisLabel);
    colorAxis(plot.getRangeAxis());
    colorAxis(plot.getDomainAxis());
    plot.getDomainAxis().setCategoryLabelPositions(
            CategoryLabelPositions.createUpRotationLabelPositions(Math.PI * cf.domainAxisLabelAngle));
    plot.getDomainAxis().setLowerMargin(cf.domainAxisLowerMargin);
    plot.getDomainAxis().setUpperMargin(cf.domainAxisUpperMargin);
    plot.getDomainAxis().setLabel(cf.domainAxisLabel);
    plot.setOutlineVisible(cf.outlineVisible);

    return chart;
}