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

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

Introduction

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

Prototype

@Override
public void setItemLabelGenerator(CategoryItemLabelGenerator generator) 

Source Link

Document

Sets the item label generator for ALL series and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:org.bench4Q.console.ui.section.E_ErrorSection.java

private JPanel printErrorPic() throws IOException {
    CategoryDataset dataset = getDataSet();
    JFreeChart chart = ChartFactory.createBarChart3D("Error", "Error type", "Error number", dataset,
            PlotOrientation.VERTICAL, true, true, true);
    CategoryPlot plot = chart.getCategoryPlot();
    org.jfree.chart.axis.CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setLowerMargin(0.1);/*w  w w  . ja  v  a 2s  . c o m*/
    domainAxis.setUpperMargin(0.1);
    domainAxis.setCategoryLabelPositionOffset(10);
    domainAxis.setCategoryMargin(0.2);
    domainAxis.setCategoryLabelPositionOffset(10);

    org.jfree.chart.axis.ValueAxis rangeAxis = plot.getRangeAxis();
    rangeAxis.setUpperMargin(0.1);

    org.jfree.chart.renderer.category.BarRenderer3D renderer;
    renderer = new org.jfree.chart.renderer.category.BarRenderer3D();
    renderer.setBaseOutlinePaint(Color.red);
    renderer.setSeriesPaint(0, new Color(0, 255, 255));
    renderer.setSeriesOutlinePaint(0, Color.BLACK);
    renderer.setSeriesPaint(1, new Color(0, 255, 0));
    renderer.setSeriesOutlinePaint(1, Color.red);
    renderer.setItemMargin(0.1);
    renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setItemLabelFont(new Font("", Font.BOLD, 12));
    renderer.setItemLabelPaint(Color.black);
    renderer.setItemLabelsVisible(true);
    plot.setRenderer(renderer);

    plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    plot.setBackgroundPaint(Color.WHITE);

    return new ChartPanel(chart);
}

From source file:org.bench4Q.console.ui.section.S_LengthSection.java

/**
 * @return/*from  w w  w  .java  2s  . c o m*/
 * @throws IOException
 */
public JPanel drawSessionPic() throws IOException {

    CategoryDataset dataset = getDataSet();
    JFreeChart chart = ChartFactory.createBarChart3D("Session", "Session type", "Session number", dataset,
            PlotOrientation.VERTICAL, true, true, true);
    CategoryPlot plot = chart.getCategoryPlot();
    org.jfree.chart.axis.CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setLowerMargin(0.1);
    domainAxis.setUpperMargin(0.1);
    domainAxis.setCategoryLabelPositionOffset(10);
    domainAxis.setCategoryMargin(0.2);

    org.jfree.chart.axis.ValueAxis rangeAxis = plot.getRangeAxis();
    rangeAxis.setUpperMargin(0.1);

    org.jfree.chart.renderer.category.BarRenderer3D renderer;
    renderer = new org.jfree.chart.renderer.category.BarRenderer3D();
    renderer.setBaseOutlinePaint(Color.red);
    renderer.setSeriesPaint(0, new Color(0, 255, 255));
    renderer.setSeriesOutlinePaint(0, Color.BLACK);
    renderer.setSeriesPaint(1, new Color(0, 255, 0));
    renderer.setSeriesOutlinePaint(1, Color.red);
    renderer.setItemMargin(0.1);
    renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setItemLabelFont(new Font("", Font.BOLD, 12));
    renderer.setItemLabelPaint(Color.black);
    renderer.setItemLabelsVisible(true);
    plot.setRenderer(renderer);

    plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    plot.setBackgroundPaint(Color.WHITE);

    return new ChartPanel(chart);
}