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

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

Introduction

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

Prototype

public void setLegendItemLabelGenerator(CategorySeriesLabelGenerator generator) 

Source Link

Document

Sets the legend item label generator and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:edu.ucla.stat.SOCR.chart.demo.BarChart3DDemo2.java

/**
 * Creates a chart./*from  ww  w  .  j  a  v a2 s . c  o m*/
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {

    JFreeChart chart = ChartFactory.createBarChart3D(chartTitle, // chart title
            domainLabel, // domain axis label
            rangeLabel, // range axis label
            dataset, // data
            PlotOrientation.HORIZONTAL, // orientation
            !legendPanelOn, // include legend
            true, // tooltips
            false // urls
    );

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setForegroundAlpha(1.0f);

    // left align the category labels...
    CategoryAxis axis = plot.getDomainAxis();
    CategoryLabelPositions p = axis.getCategoryLabelPositions();

    CategoryLabelPosition left = new CategoryLabelPosition(RectangleAnchor.LEFT, TextBlockAnchor.CENTER_LEFT,
            TextAnchor.CENTER_LEFT, 0.0, CategoryLabelWidthType.RANGE, 0.30f);
    axis.setCategoryLabelPositions(CategoryLabelPositions.replaceLeftPosition(p, left));

    BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer();
    renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
    setCategorySummary(dataset);
    return chart;

}

From source file:unikn.dbis.univis.visualization.chart.BarChart.java

/**
 * starts the Bar3DChart.//from   w  w w  .ja va  2s . c o  m
 */
public void plot() {
    CategoryPlot plot = (CategoryPlot) getChart().getPlot();
    CategoryAxis axis = plot.getDomainAxis();
    axis.setTickLabelsVisible(false);
    BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setLegendItemLabelGenerator(new LabelGenerator(createTotal()));
    plot.setNoDataMessage("No data available");
    plot.getDomainAxis().setLabelFont(getLegendFont());
    plot.getRangeAxis().setLabelFont(getLegendFont());
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
}

From source file:edu.ucla.stat.SOCR.chart.demo.BarChart3DDemo1.java

/**
 * Creates a 3D bar chart./*from   w w w.j  av  a 2 s  .  co  m*/
 * 
 * @param dataset  the category dataset.
 * 
 * @return The chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {

    JFreeChart chart = ChartFactory.createBarChart3D(chartTitle, // chart title
            domainLabel, // domain axis label
            rangeLabel, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            !legendPanelOn, // include legend
            true, // tooltips
            false // urls
    );

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setDomainGridlinesVisible(true);
    CategoryAxis axis = plot.getDomainAxis();
    axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 8.0));
    BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer();
    renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
    renderer.setDrawBarOutline(false);

    setCategorySummary(dataset);
    return chart;

}

From source file:edu.ucla.stat.SOCR.chart.SuperCategoryChart_Bar3D.java

protected JFreeChart createLegend(CategoryDataset dataset) {

    //  JFreeChart chart = ChartFactory.createAreaChart(
    JFreeChart chart = ChartFactory.createBarChart3D(chartTitle, // chart title
            "Category", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
    );/*from w w w. ja  v  a 2  s  .  c  o m*/

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = chart.getCategoryPlot();

    BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer();
    // renderer.setDrawOutlines(true);
    // renderer.setUseFillPaint(true);
    // renderer.setFillPaint(Color.white);
    renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
    return chart;

}