Example usage for org.jfree.chart.plot CategoryPlot addRangeMarker

List of usage examples for org.jfree.chart.plot CategoryPlot addRangeMarker

Introduction

In this page you can find the example usage for org.jfree.chart.plot CategoryPlot addRangeMarker.

Prototype

public void addRangeMarker(Marker marker, Layer layer) 

Source Link

Document

Adds a marker for display against the range axis and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:org.jfree.chart.demo.BarChart3DDemo4.java

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart3D("Student Grades", "Students", "Grade",
            categorydataset, PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    CustomBarRenderer3D custombarrenderer3d = new CustomBarRenderer3D();
    custombarrenderer3d.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    custombarrenderer3d.setBaseItemLabelsVisible(true);
    custombarrenderer3d.setItemLabelAnchorOffset(10D);
    custombarrenderer3d.setBasePositiveItemLabelPosition(
            new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));
    categoryplot.setRenderer(custombarrenderer3d);
    ValueMarker valuemarker = new ValueMarker(0.69999999999999996D, new Color(200, 200, 255),
            new BasicStroke(1.0F), new Color(200, 200, 255), new BasicStroke(1.0F), 1.0F);
    categoryplot.addRangeMarker(valuemarker, Layer.BACKGROUND);
    custombarrenderer3d.setBaseItemLabelsVisible(true);
    custombarrenderer3d.setMaximumBarWidth(0.050000000000000003D);
    CategoryTextAnnotation categorytextannotation = new CategoryTextAnnotation("Minimum grade to pass",
            "Robert", 0.70999999999999996D);
    categorytextannotation.setCategoryAnchor(CategoryAnchor.START);
    categorytextannotation.setFont(new Font("SansSerif", 0, 12));
    categorytextannotation.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categoryplot.addAnnotation(categorytextannotation);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setNumberFormatOverride(NumberFormat.getPercentInstance());
    numberaxis.setUpperMargin(0.10000000000000001D);
    return jfreechart;
}

From source file:org.hxzon.demo.jfreechart.CategoryDatasetDemo2.java

private static JFreeChart createWaterfallChart(CategoryDataset dataset) {

    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    categoryAxis.setCategoryMargin(0.0);

    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);

    WaterfallBarRenderer renderer = new WaterfallBarRenderer();
    if (orientation == PlotOrientation.HORIZONTAL) {
        ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER,
                TextAnchor.CENTER, Math.PI / 2.0);
        renderer.setBasePositiveItemLabelPosition(position);
        renderer.setBaseNegativeItemLabelPosition(position);
    } else if (orientation == PlotOrientation.VERTICAL) {
        ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER,
                TextAnchor.CENTER, 0.0);
        renderer.setBasePositiveItemLabelPosition(position);
        renderer.setBaseNegativeItemLabelPosition(position);
    }/*  w  w w.  j a  va 2  s  .  c o  m*/
    if (tooltips) {
        StandardCategoryToolTipGenerator generator = new StandardCategoryToolTipGenerator();
        renderer.setBaseToolTipGenerator(generator);
    }
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.clearRangeMarkers();
    Marker baseline = new ValueMarker(0.0);
    baseline.setPaint(Color.black);
    plot.addRangeMarker(baseline, Layer.FOREGROUND);
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart("Waterfall Chart Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    chart.setBackgroundPaint(Color.white);

    valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64));
    //        GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0));
    GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0));
    //        AbstractRenderer#setSeriesPaint(int, Paint) are ignored;
    //        renderer.setSeriesPaint(0, gp0);
    //        renderer.setSeriesPaint(1, gp1);
    //        renderer.setSeriesPaint(2, gp2);

    //??
    renderer.setFirstBarPaint(gp0);
    renderer.setLastBarPaint(gp2);
    renderer.setPositiveBarPaint(Color.orange);
    renderer.setNegativeBarPaint(Color.cyan);

    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    return chart;

}

From source file:org.jfree.chart.demo.WaterfallChartDemo2.java

/**
 * Returns the chart.// w ww.  ja  v  a 2  s. co m
 *
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
private JFreeChart createChart(final CategoryDataset dataset) {

    final CategoryAxis xAxis = new CategoryAxis("Category");
    final NumberAxis yAxis = new NumberAxis("$ in Thousands");
    yAxis.setLowerMargin(0.10);
    yAxis.setUpperMargin(0.10);

    // create a custom tick unit collection...
    final DecimalFormat formatter = new DecimalFormat("##,###");
    formatter.setNegativePrefix("(");
    formatter.setNegativeSuffix(")");
    final TickUnits standardUnits = new TickUnits();
    standardUnits.add(new NumberTickUnit(200, formatter));
    standardUnits.add(new NumberTickUnit(500, formatter));
    standardUnits.add(new NumberTickUnit(1000, formatter));
    standardUnits.add(new NumberTickUnit(2000, formatter));
    standardUnits.add(new NumberTickUnit(5000, formatter));

    yAxis.setStandardTickUnits(standardUnits);

    // ****************************************************************************
    // * JFREECHART DEVELOPER GUIDE                                               *
    // * The JFreeChart Developer Guide, written by David Gilbert, is available   *
    // * to purchase from Object Refinery Limited:                                *
    // *                                                                          *
    // * http://www.object-refinery.com/jfreechart/guide.html                     *
    // *                                                                          *
    // * Sales are used to provide funding for the JFreeChart project - please    * 
    // * support us so that we can continue developing free software.             *
    // ****************************************************************************

    final DecimalFormat labelFormatter = new DecimalFormat("##,###");
    labelFormatter.setNegativePrefix("(");
    labelFormatter.setNegativeSuffix(")");

    final WaterfallBarRenderer renderer = new WaterfallBarRenderer();
    //        renderer.setLabelGenerator(
    //          new StandardCategoryLabelGenerator("{2}", labelFormatter)
    //    );
    renderer.setItemLabelsVisible(Boolean.TRUE);

    final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.white);
    plot.setRangeGridlinesVisible(true);
    final ValueMarker baseline = new ValueMarker(0.0);
    baseline.setPaint(Color.blue);
    baseline.setStroke(new BasicStroke(1.1f));
    plot.addRangeMarker(baseline, Layer.FOREGROUND);

    final JFreeChart chart = new JFreeChart("OM WaterFall Chart", JFreeChart.DEFAULT_TITLE_FONT, plot, false);
    chart.setBackgroundPaint(Color.white);
    return chart;
}

From source file:scheduler.benchmarker.manager.CreateStackedBarChart3D.java

public ChartPanel createChartPanel() {
    JFreeChart jfreechart = ChartFactory.createStackedBarChart3D(title, "Category", "Value", createDataset(),
            PlotOrientation.HORIZONTAL, true, true, false);
    jfreechart.setBackgroundPaint(new Color(214, 217, 223));

    CustomBarRenderer cRenderer = new CustomBarRenderer(pluginColors);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();

    ValueMarker marker = new ValueMarker(dataSource.getSumTotalTime());

    marker.setLabel("CLASSIFICATION FINISH");
    marker.setPaint(Color.RED);/*from w  w w .jav  a  2  s  . c o m*/
    marker.setLabelPaint(Color.RED);
    marker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
    marker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
    marker.setLabelOffsetType(LengthAdjustmentType.EXPAND);
    marker.setLabelFont(new Font(Font.SERIF, Font.BOLD, 12));

    categoryplot.addRangeMarker(marker, Layer.FOREGROUND);
    categoryplot.setFixedLegendItems(createCustomLegend());
    categoryplot.setRenderer(cRenderer);
    cPanel = new ChartPanel(jfreechart, true);
    return cPanel;
}

From source file:it.eng.spagobi.engines.kpi.bo.charttypes.dialcharts.BulletGraph.java

public JFreeChart createChart() {

    logger.debug("IN");
    Number value = null;/*from   w  w  w  .jav a2  s .  co m*/

    if (dataset == null) {
        logger.debug("The dataset to be represented is null");
        value = new Double(0);
    } else {
        value = dataset.getValue();
    }

    DefaultCategoryDataset datasetC = new DefaultCategoryDataset();
    datasetC.addValue(value, "", "");

    // customize a bar chart 
    JFreeChart chart = ChartFactory.createBarChart(null, null, null, datasetC, PlotOrientation.HORIZONTAL,
            false, false, false);
    chart.setBorderVisible(false);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setOutlineVisible(true);
    plot.setOutlinePaint(Color.BLACK);

    plot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0));
    plot.setBackgroundPaint(null);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);
    plot.setRangeCrosshairVisible(false);
    plot.setAnchorValue(value.doubleValue());

    // add the target marker 
    if (target != null) {
        ValueMarker marker = new ValueMarker(target.doubleValue(), Color.BLACK, new BasicStroke(2.0f));
        plot.addRangeMarker(marker, Layer.FOREGROUND);
    }

    //sets different marks
    for (Iterator iterator = intervals.iterator(); iterator.hasNext();) {
        KpiInterval interval = (KpiInterval) iterator.next();
        // add the marks 
        IntervalMarker marker = new IntervalMarker(interval.getMin(), interval.getMax(), interval.getColor());
        plot.addRangeMarker(marker, Layer.BACKGROUND);
        logger.debug("Added new interval to the plot");
    }

    // customize axes 
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setVisible(false);

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setVisible(show_axis);
    rangeAxis.setLabelFont(new Font("Arial", Font.PLAIN, 4));
    // calculate the upper limit 
    //double upperBound = target * upperFactor; 
    rangeAxis.setRange(new Range(lower, upper));
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    // customize renderer 
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setMaximumBarWidth(0.18);
    renderer.setSeriesPaint(0, Color.BLACK);
    /*BasicStroke d = new BasicStroke(3f,BasicStroke.CAP_ROUND ,BasicStroke.JOIN_ROUND);
    renderer.setSeriesOutlineStroke(0, d);
    renderer.setSeriesStroke(0, d);
            
    renderer.setStroke(d);*/

    return chart;
}

From source file:com.intel.stl.ui.common.view.ComponentFactory.java

public static JFreeChart createBulletChart(CategoryDataset dataset, double[] thresholds, Color[] colors) {
    if (thresholds.length != colors.length) {
        throw new IllegalArgumentException(
                "Inconsistant array sizes: thresholds=" + thresholds.length + " colors=" + colors.length);
    }/*from   ww  w . java  2s.co m*/

    JFreeChart jfreechart = ChartFactory.createBarChart(null, null, null, dataset, PlotOrientation.HORIZONTAL,
            false, true, false);
    CategoryPlot categoryplot = jfreechart.getCategoryPlot();
    categoryplot.setBackgroundPaint(null);
    categoryplot.setOutlinePaint(null);

    categoryplot.getDomainAxis().setVisible(false);

    NumberAxis rangeAxis = (NumberAxis) categoryplot.getRangeAxis();
    rangeAxis.setVisible(false);
    rangeAxis.setRange(new Range(0, 1.0));

    double last = 0.0;
    for (int i = 0; i < thresholds.length; i++) {
        IntervalMarker marker = new IntervalMarker(last, thresholds[i], colors[i]);
        categoryplot.addRangeMarker(marker, Layer.BACKGROUND);
        last = thresholds[i];
    }

    BarRenderer renderer = (BarRenderer) categoryplot.getRenderer();
    renderer.setShadowVisible(false);
    renderer.setMaximumBarWidth(0.33);
    renderer.setSeriesPaint(0, UIConstants.INTEL_DARK_GRAY);

    return jfreechart;
}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.dialcharts.BulletGraph.java

public JFreeChart createChart(DatasetMap datasets) {

    logger.debug("IN");
    Dataset dataset = (Dataset) datasets.getDatasets().get("1");
    ValueDataset valDataSet = (ValueDataset) dataset;

    Number value = valDataSet.getValue();

    DefaultCategoryDataset datasetC = new DefaultCategoryDataset();
    datasetC.addValue(value, "", "");

    // customize a bar chart 
    JFreeChart chart = ChartFactory.createBarChart(null, null, null, datasetC, PlotOrientation.HORIZONTAL,
            false, false, false);//from w  ww  .  j  av a2  s .co  m
    chart.setBorderVisible(false);

    chart.setBackgroundPaint(color);

    TextTitle title = setStyleTitle(name, styleTitle);
    chart.setTitle(title);
    if (subName != null && !subName.equals("")) {
        TextTitle subTitle = setStyleTitle(subName, styleSubTitle);
        chart.addSubtitle(subTitle);
    }

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setOutlineVisible(true);
    plot.setOutlinePaint(Color.BLACK);
    plot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0));
    plot.setBackgroundPaint(null);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);
    plot.setRangeCrosshairVisible(false);
    plot.setAnchorValue(value.doubleValue());

    // add the target marker 
    if (target != null) {
        ValueMarker marker = new ValueMarker(target.doubleValue(), Color.BLACK, new BasicStroke(2.0f));
        plot.addRangeMarker(marker, Layer.FOREGROUND);
    }

    //sets different marks
    for (Iterator iterator = intervals.iterator(); iterator.hasNext();) {
        KpiInterval interval = (KpiInterval) iterator.next();
        // add the marks 
        IntervalMarker marker = new IntervalMarker(interval.getMin(), interval.getMax(), interval.getColor());
        plot.addRangeMarker(marker, Layer.BACKGROUND);
        logger.debug("Added new interval to the plot");
    }

    // customize axes 
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setVisible(false);

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setVisible(true);
    // calculate the upper limit 
    //double upperBound = target * upperFactor; 
    rangeAxis.setRange(new Range(lower, upper));
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    // customize renderer 
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setMaximumBarWidth(0.18);
    renderer.setSeriesPaint(0, Color.BLACK);

    return chart;
}

From source file:j2se.jfreechart.barchart.BarChartDemo7.java

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

    // create the chart...
    final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 7", // chart title
            "Category", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            false, // include legend
            true, // tooltips?
            false // URLs?
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    final IntervalMarker target = new IntervalMarker(4.5, 7.5);
    target.setLabel("Target Range");
    target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11));
    target.setLabelAnchor(RectangleAnchor.LEFT);
    target.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
    target.setPaint(new Color(222, 222, 255, 128));
    plot.addRangeMarker(target, Layer.BACKGROUND);

    // set the range axis to display integers only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // disable bar outlines...
    final BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setItemMargin(0.10);

    // set up gradient paints for series...
    final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.lightGray);
    final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray);
    final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray);
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    //      renderer.setLabelGenerator(new BarChartDemo7.LabelGenerator());
    renderer.setItemLabelsVisible(true);
    final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.CENTER_RIGHT,
            TextAnchor.CENTER_RIGHT, -Math.PI / 2.0);
    renderer.setPositiveItemLabelPosition(p);

    final ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.CENTER_LEFT,
            TextAnchor.CENTER_LEFT, -Math.PI / 2.0);
    renderer.setPositiveItemLabelPositionFallback(p2);
    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:org.mars_sim.msp.ui.swing.demo.BarChartDemo7.java

/**
 * Creates a sample chart.//from ww  w .j av a 2s  .c  om
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
*/
private JFreeChart createChart(final CategoryDataset dataset) {

    // create the chart...
    final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 7", // chart title
            "Category", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            false, // include legend
            true, // tooltips?
            false // URLs?
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    final IntervalMarker target = new IntervalMarker(4.5, 7.5);
    target.setLabel("Target Range");
    target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11));
    target.setLabelAnchor(RectangleAnchor.LEFT);
    target.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
    target.setPaint(new Color(222, 222, 255, 128));
    plot.addRangeMarker(target, Layer.BACKGROUND);

    // set the range axis to display integers only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // disable bar outlines...
    final BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    //renderer.setItemMargin(0.10);
    renderer.setMaximumBarWidth(.5); // set maximum width to 35% of chart

    // set up gradient paints for series...
    final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.lightGray);
    final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray);
    final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray);
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    //      renderer.setLabelGenerator(new BarChartDemo7.LabelGenerator());
    renderer.setDefaultItemLabelsVisible(true);
    final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.CENTER_RIGHT,
            TextAnchor.CENTER_RIGHT, -Math.PI / 2.0);
    renderer.setDefaultPositiveItemLabelPosition(p);

    final ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.CENTER_LEFT,
            TextAnchor.CENTER_LEFT, -Math.PI / 2.0);
    renderer.setPositiveItemLabelPositionFallback(p2);
    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

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

/**
 * Creates a sample chart./*from  www .ja  va 2  s  .com*/
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {

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

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    IntervalMarker target = new IntervalMarker(4.5, 7.5);
    target.setLabel("Target Range");
    target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11));
    target.setLabelAnchor(RectangleAnchor.LEFT);
    target.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
    target.setPaint(new Color(222, 222, 255, 128));
    plot.addRangeMarker(target, Layer.BACKGROUND);

    // set the range axis to display integers only...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // disable bar outlines...
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setItemMargin(0.10);

    // set up gradient paints for series...
    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.lightGray);
    GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray);
    GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray);
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);
    renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

    renderer.setBaseItemLabelGenerator(new CustomCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);
    ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.CENTER_RIGHT,
            TextAnchor.CENTER_RIGHT, -Math.PI / 2.0);
    renderer.setBasePositiveItemLabelPosition(p);

    ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.CENTER_LEFT,
            TextAnchor.CENTER_LEFT, -Math.PI / 2.0);
    renderer.setPositiveItemLabelPositionFallback(p2);
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    // OPTIONAL CUSTOMISATION COMPLETED.
    setCategorySummary(dataset);
    return chart;

}