Example usage for org.jfree.chart JFreeChart DEFAULT_TITLE_FONT

List of usage examples for org.jfree.chart JFreeChart DEFAULT_TITLE_FONT

Introduction

In this page you can find the example usage for org.jfree.chart JFreeChart DEFAULT_TITLE_FONT.

Prototype

Font DEFAULT_TITLE_FONT

To view the source code for org.jfree.chart JFreeChart DEFAULT_TITLE_FONT.

Click Source Link

Document

The default font for titles.

Usage

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

private static JFreeChart createPieChart(PieDataset dataset, PieDataset previousDataset) {
    final boolean greenForIncrease = true;
    final boolean subTitle = true;
    final boolean showDifference = true;
    int percentDiffForMaxScale = 20;
    PiePlot plot = new PiePlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));

    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }/*from  w ww  .  ja  v a  2 s .c o  m*/
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    List<Comparable> keys = dataset.getKeys();
    DefaultPieDataset series = null;
    if (showDifference) {
        series = new DefaultPieDataset();
    }

    double colorPerPercent = 255.0 / percentDiffForMaxScale;
    for (@SuppressWarnings("rawtypes")
    Comparable key : keys) {
        Number newValue = dataset.getValue(key);
        Number oldValue = previousDataset.getValue(key);

        if (oldValue == null) {
            if (greenForIncrease) {
                plot.setSectionPaint(key, Color.green);
            } else {
                plot.setSectionPaint(key, Color.red);
            }
            if (showDifference) {
                series.setValue(key + " (+100%)", newValue);
            }
        } else {
            double percentChange = (newValue.doubleValue() / oldValue.doubleValue() - 1.0) * 100.0;
            double shade = (Math.abs(percentChange) >= percentDiffForMaxScale ? 255
                    : Math.abs(percentChange) * colorPerPercent);
            if (greenForIncrease && newValue.doubleValue() > oldValue.doubleValue()
                    || !greenForIncrease && newValue.doubleValue() < oldValue.doubleValue()) {
                plot.setSectionPaint(key, new Color(0, (int) shade, 0));
            } else {
                plot.setSectionPaint(key, new Color((int) shade, 0, 0));
            }
            if (showDifference) {
                series.setValue(
                        key + " (" + (percentChange >= 0 ? "+" : "")
                                + NumberFormat.getPercentInstance().format(percentChange / 100.0) + ")",
                        newValue);
            }
        }
    }

    if (showDifference) {
        plot.setDataset(series);
    }

    JFreeChart chart = new JFreeChart("Pie Chart Demo 2", JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

    if (subTitle) {
        TextTitle subtitle = null;
        subtitle = new TextTitle("Bright " + (greenForIncrease ? "red" : "green") + "=change >=-"
                + percentDiffForMaxScale + "%, Bright " + (!greenForIncrease ? "red" : "green") + "=change >=+"
                + percentDiffForMaxScale + "%", new Font("SansSerif", Font.PLAIN, 10));
        chart.addSubtitle(subtitle);
    }
    plot.setNoDataMessage("No data available");

    return chart;

}

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

private static JFreeChart createTimeSeriesChart(XYDataset dataset) {
    //DomainAxis/*from  ww  w  . j  a va 2  s  .co  m*/
    DateAxis timeAxis = new DateAxis("");
    timeAxis.setLowerMargin(0.02); // reduce the default margins
    timeAxis.setUpperMargin(0.02);
    timeAxis.setDateFormatOverride(new SimpleDateFormat("MM-yyyy"));
    //RangeAxis
    NumberAxis valueAxis = new NumberAxis("");
    valueAxis.setAutoRangeIncludesZero(false); // override default
    //        valueAxis.setAutoRange(false);
    //        valueAxis.setDefaultAutoRange(new Range(100, 1150));
    //Renderer
    XYToolTipGenerator toolTipGenerator = StandardXYToolTipGenerator.getTimeSeriesInstance();
    XYURLGenerator urlGenerator = null;
    //            urlGenerator = new StandardXYURLGenerator();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);
    renderer.setBaseToolTipGenerator(toolTipGenerator);
    renderer.setURLGenerator(urlGenerator);
    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);
    renderer.setDrawSeriesLineAsPath(true);
    //Plot
    XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);
    plot.setRenderer(renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    //        plot.setRangePannable(true);
    //chart
    JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true);

    chart.setBackgroundPaint(Color.white);
    return chart;
}

From source file:org.pentaho.plugin.jfreereport.reportcharts.RadarChartExpression.java

protected JFreeChart computeChart(final Dataset dataset) {

    //Initializing a default CategoryDataset
    DefaultCategoryDataset defaultDataset = new DefaultCategoryDataset();

    if (dataset instanceof DefaultCategoryDataset) {
        defaultDataset = (DefaultCategoryDataset) dataset;
    }/*from w w w  . j  a  va2s .c om*/

    //Retrieving the size of the dataset for parsing

    //Parse the dataset in order to find the biggest value
    if (drawgrid == true) {
        initializeGrid(defaultDataset);
    }

    //Instantiate a spiderwebplot
    final ExtendedSpiderWebPlot plot = new ExtendedSpiderWebPlot(defaultDataset);
    for (int i = 0; i < this.getSeriesColor().length; i++) {
        Color seriesColor;
        String colorDef = this.getSeriesColor(i);
        if (colorDef == null) {
            seriesColor = Color.RED;
        } else {
            seriesColor = ColorHelper.lookupColor(colorDef);
            if (seriesColor == null) {
                seriesColor = Color.decode(colorDef);
            }
        }
        plot.setSeriesPaint(i, seriesColor);
    }
    //Instantiate a JFreeChart using the plot from above
    return new JFreeChart(computeTitle(), JFreeChart.DEFAULT_TITLE_FONT, plot, isShowLegend());
}

From source file:org.spantus.exp.segment.draw.AbstractGraphGenerator.java

public JFreeChart getChart(ComparisionResult result) {
    CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Time"));
    plot.setGap(10.0);/*from   w w  w  .j a v a 2  s. c  o m*/
    plot.setOrientation(PlotOrientation.VERTICAL);

    XYSeriesCollection[] seriesArr = createSeries(result);
    for (XYSeriesCollection series : seriesArr) {
        XYSeriesCollection data = series;
        StandardXYItemRenderer renderer = new StandardXYItemRenderer();
        renderer.setAutoPopulateSeriesPaint(false);
        renderer.setBasePaint(Color.BLACK);
        NumberAxis rangeAxis = new NumberAxis();
        rangeAxis.setLabel(((XYSeries) series.getSeries().get(0)).getDescription());
        rangeAxis.setAutoRange(true);
        XYPlot subplot = new XYPlot(data, null, rangeAxis, renderer);
        plot.add(subplot);
    }
    String name = result.getName() == null ? "Segmentation" : "Segmentation: " + result.getName();

    JFreeChart chart = new JFreeChart(name, JFreeChart.DEFAULT_TITLE_FONT, plot, true);

    return chart;

}

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

private static JFreeChart createTimeSeriesChart(XYDataset dataset) {

    DateAxis timeAxis = new DateAxis(xAxisLabel);
    timeAxis.setLowerMargin(0.02); // reduce the default margins
    timeAxis.setUpperMargin(0.02);/*w  w w. j a v  a  2s .c  o  m*/
    NumberAxis valueAxis = new NumberAxis(yAxisLabel);
    valueAxis.setAutoRangeIncludesZero(false); // override default
    XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);

    XYToolTipGenerator toolTipGenerator = null;
    if (tooltips) {
        toolTipGenerator = StandardXYToolTipGenerator.getTimeSeriesInstance();
    }

    XYURLGenerator urlGenerator = null;
    if (urls) {
        urlGenerator = new StandardXYURLGenerator();
    }

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);
    renderer.setBaseToolTipGenerator(toolTipGenerator);
    renderer.setURLGenerator(urlGenerator);
    plot.setRenderer(renderer);

    JFreeChart chart = new JFreeChart("TimeSeries Chart Demo", JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    chart.setBackgroundPaint(Color.white);

    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    //        renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);
    renderer.setDrawSeriesLineAsPath(true);

    timeAxis.setDateFormatOverride(new SimpleDateFormat("MM-yyyy"));

    return chart;
}

From source file:org.moeaframework.analysis.plot.Plot.java

/**
 * If the chart has not yet been initialized, creates a chart for XY data.
 * If the chart is already initialized, checks if the chart is for XY data.
 * //  www  .  ja  va2s. c om
 * @throws FrameworkException if the chart does not support XY data
 */
private void createXYPlot() {
    if (chart == null) {
        NumberAxis xAxis = new NumberAxis("");
        xAxis.setAutoRangeIncludesZero(false);
        NumberAxis yAxis = new NumberAxis("");
        yAxis.setAutoRangeIncludesZero(false);

        XYPlot plot = new XYPlot();
        plot.setDomainAxis(xAxis);
        plot.setRangeAxis(yAxis);

        XYToolTipGenerator toolTipGenerator = new StandardXYToolTipGenerator();

        XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true);
        renderer.setBaseToolTipGenerator(toolTipGenerator);
        plot.setRenderer(renderer);
        plot.setOrientation(PlotOrientation.VERTICAL);

        chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
        ChartFactory.getChartTheme().apply(chart);
    } else if (!(chart.getPlot() instanceof XYPlot)) {
        throw new FrameworkException("Can not combine XY plot and categorial plot");
    }
}

From source file:de.bund.bfr.knime.pmm.common.chart.ChartCreator.java

public JFreeChart getChart(List<String> idsToPaint) {
    if (paramX == null || paramY == null) {
        return new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, new XYPlot(), showLegend);
    }/*from w  w  w .  j  ava  2  s  .co  m*/

    NumberAxis xAxis = new NumberAxis(AttributeUtilities.getNameWithUnit(paramX, unitX, transformX));
    NumberAxis yAxis = new NumberAxis(AttributeUtilities.getNameWithUnit(paramY, unitY, transformY));
    XYPlot plot = new XYPlot(null, xAxis, yAxis, null);
    double usedMinX = Double.POSITIVE_INFINITY;
    double usedMaxX = Double.NEGATIVE_INFINITY;
    int index = 0;
    ColorAndShapeCreator colorAndShapeCreator = new ColorAndShapeCreator(idsToPaint.size());

    for (String id : idsToPaint) {
        Plotable plotable = plotables.get(id);

        try {
            if (plotable != null) {
                if (plotable.getType() == Plotable.BOTH || plotable.getType() == Plotable.BOTH_STRICT) {
                    Double minArg = Plotable.transform(
                            plotable.convertToUnit(paramX, plotable.getMinArguments().get(paramX), unitX),
                            transformX);
                    Double maxArg = Plotable.transform(
                            plotable.convertToUnit(paramX, plotable.getMaxArguments().get(paramX), unitX),
                            transformX);

                    if (isValid(minArg)) {
                        usedMinX = Math.min(usedMinX, minArg);
                    }

                    if (isValid(maxArg)) {
                        usedMaxX = Math.max(usedMaxX, maxArg);
                    }

                    for (Map<String, Integer> choice : plotable.getAllChoices()) {
                        double[][] points = plotable.getPoints(paramX, paramY, unitX, unitY, transformX,
                                transformY, choice);

                        if (points != null) {
                            for (int i = 0; i < points[0].length; i++) {
                                if (isValid(points[0][i])) {
                                    usedMinX = Math.min(usedMinX, points[0][i]);
                                    usedMaxX = Math.max(usedMaxX, points[0][i]);
                                }
                            }
                        }
                    }
                } else if (plotable.getType() == Plotable.DATASET
                        || plotable.getType() == Plotable.DATASET_STRICT) {
                    double[][] points = plotable.getPoints(paramX, paramY, unitX, unitY, transformX,
                            transformY);

                    if (points != null) {
                        for (int i = 0; i < points[0].length; i++) {
                            if (isValid(points[0][i])) {
                                usedMinX = Math.min(usedMinX, points[0][i]);
                                usedMaxX = Math.max(usedMaxX, points[0][i]);
                            }
                        }
                    }
                } else if (plotable.getType() == Plotable.FUNCTION) {
                    Double minArg = Plotable.transform(
                            plotable.convertToUnit(paramX, plotable.getMinArguments().get(paramX), unitX),
                            transformX);
                    Double maxArg = Plotable.transform(
                            plotable.convertToUnit(paramX, plotable.getMaxArguments().get(paramX), unitX),
                            transformX);

                    if (isValid(minArg)) {
                        usedMinX = Math.min(usedMinX, minArg);
                    }

                    if (isValid(maxArg)) {
                        usedMaxX = Math.max(usedMaxX, maxArg);
                    }
                } else if (plotable.getType() == Plotable.FUNCTION_SAMPLE) {
                    Double minArg = Plotable.transform(
                            plotable.convertToUnit(paramX, plotable.getMinArguments().get(paramX), unitX),
                            transformX);
                    Double maxArg = Plotable.transform(
                            plotable.convertToUnit(paramX, plotable.getMaxArguments().get(paramX), unitX),
                            transformX);

                    if (isValid(minArg)) {
                        usedMinX = Math.min(usedMinX, minArg);
                    }

                    if (isValid(maxArg)) {
                        usedMaxX = Math.max(usedMaxX, maxArg);
                    }

                    for (Double x : plotable.getSamples()) {
                        Double xx = Plotable.transform(plotable.convertToUnit(paramX, x, unitX), transformX);

                        if (isValid(xx)) {
                            usedMinX = Math.min(usedMinX, xx);
                            usedMaxX = Math.max(usedMaxX, xx);
                        }
                    }
                }
            }
        } catch (ConvertException e) {
        }
    }

    if (Double.isInfinite(usedMinX)) {
        usedMinX = 0.0;
    }

    if (Double.isInfinite(usedMaxX)) {
        usedMaxX = 100.0;
    }

    if (paramX.equals(AttributeUtilities.TIME) || paramX.equals(AttributeUtilities.CONCENTRATION)) {
        usedMinX = Math.min(usedMinX, 0.0);
        xAxis.setAutoRangeIncludesZero(true);
    } else {
        xAxis.setAutoRangeIncludesZero(false);
    }

    if (paramY.equals(AttributeUtilities.TIME) || paramY.equals(AttributeUtilities.CONCENTRATION)) {
        yAxis.setAutoRangeIncludesZero(true);
    } else {
        yAxis.setAutoRangeIncludesZero(false);
    }

    if (usedMinX == usedMaxX) {
        usedMinX -= 1.0;
        usedMaxX += 1.0;
    }

    if (useManualRange && minX < maxX && minY < maxY) {
        usedMinX = minX;
        usedMaxX = maxX;
        xAxis.setRange(new Range(minX, maxX));
        yAxis.setRange(new Range(minY, maxY));
    }

    Set<ConvertException> convertExceptions = new LinkedHashSet<>();

    for (String id : idsToPaint) {
        Plotable plotable = plotables.get(id);

        if (plotable != null && plotable.getType() == Plotable.DATASET) {
            try {
                plotDataSet(plot, plotable, id, colorAndShapeCreator.getColorList().get(index),
                        colorAndShapeCreator.getShapeList().get(index));
                index++;
            } catch (ConvertException e) {
                convertExceptions.add(e);
            }
        }
    }

    for (String id : idsToPaint) {
        Plotable plotable = plotables.get(id);

        if (plotable != null && plotable.getType() == Plotable.DATASET_STRICT) {
            try {
                plotDataSetStrict(plot, plotable, id);
                index++;
            } catch (ConvertException e) {
                convertExceptions.add(e);
            }
        }
    }

    for (String id : idsToPaint) {
        Plotable plotable = plotables.get(id);

        if (plotable != null && plotable.getType() == Plotable.FUNCTION) {
            try {
                plotFunction(plot, plotable, id, colorAndShapeCreator.getColorList().get(index),
                        colorAndShapeCreator.getShapeList().get(index), usedMinX, usedMaxX);
                index++;
            } catch (ConvertException e) {
                convertExceptions.add(e);
            }
        }
    }

    warnings = new ArrayList<>();

    for (String id : idsToPaint) {
        Plotable plotable = plotables.get(id);

        if (plotable != null && plotable.getType() == Plotable.FUNCTION_SAMPLE) {
            try {
                plotFunctionSample(plot, plotable, id, colorAndShapeCreator.getColorList().get(index),
                        colorAndShapeCreator.getShapeList().get(index), usedMinX, usedMaxX, warnings);
                index++;
            } catch (ConvertException e) {
                convertExceptions.add(e);
            }
        }
    }

    for (String id : idsToPaint) {
        Plotable plotable = plotables.get(id);

        if (plotable != null && plotable.getType() == Plotable.BOTH) {
            try {
                plotBoth(plot, plotable, id, colorAndShapeCreator.getColorList().get(index),
                        colorAndShapeCreator.getShapeList().get(index), usedMinX, usedMaxX);
                index++;
            } catch (ConvertException e) {
                convertExceptions.add(e);
            }
        }
    }

    for (String id : idsToPaint) {
        Plotable plotable = plotables.get(id);

        if (plotable != null && plotable.getType() == Plotable.BOTH_STRICT) {
            try {
                plotBothStrict(plot, plotable, id, usedMinX, usedMaxX);
                index++;
            } catch (ConvertException e) {
                convertExceptions.add(e);
            }
        }
    }

    if (!convertExceptions.isEmpty()) {
        String warning = "Some datasets/functions cannot be converted to the desired unit\n";

        warning += "Uncovertable units: ";

        for (ConvertException e : convertExceptions) {
            warning += e.getFromUnit() + "->" + e.getToUnit() + ", ";
        }

        warning = warning.substring(0, warning.length() - 2);

        JOptionPane.showMessageDialog(this, warning, "Warning", JOptionPane.WARNING_MESSAGE);
    }

    return new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, showLegend);
}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.DoseResponseController.java

/**
 * Create a dose-response chart containing experimental data, simulated data
 * and an annotated R value.//from  www.ja va  2s.  c  o  m
 *
 * @param dataToPlot The experimental data on which the fit was performed
 * @param analysisGroup The analysis group
 * @param normalized Whether the responses are normalized
 * @return
 */
public JFreeChart createDoseResponseChart(List<DoseResponsePair> dataToPlot,
        DoseResponseAnalysisGroup analysisGroup, boolean normalized) {
    // setup scatter data of experimental concentrations/slopes, renderer and axis
    XYSeriesCollection experimentalData = new XYSeriesCollection();
    XYSeries scatterXYSeries = JFreeChartUtils.generateXYSeries(AnalysisUtils.generateXValues(dataToPlot),
            AnalysisUtils.generateYValues(dataToPlot));
    scatterXYSeries.setKey("Experimental data");
    experimentalData.addSeries(scatterXYSeries);

    // compute how far the simulated data and axes should range: from the lowest and highest dose continue half of the range between these two
    List<Double> extremes = new ArrayList<>();
    Double range = Math.abs(scatterXYSeries.getMaxX() - scatterXYSeries.getMinX());
    extremes.add(scatterXYSeries.getMinX() - (range / 2));
    extremes.add(scatterXYSeries.getMaxX() + (range / 2));

    // Create the simulated line data, renderer, and axis
    XYSeriesCollection fitting = new XYSeriesCollection();
    // create xy series of simulated data from the parameters from the fitting
    SigmoidFittingResultsHolder resultsHolder = analysisGroup.getDoseResponseAnalysisResults()
            .getFittingResults(normalized);
    XYSeries fittingData = simulateData(resultsHolder, extremes);
    fittingData.setKey("Fitting");
    fitting.addSeries(fittingData);

    XYPlot plot = JFreeChartUtils.setupDoseResponseDatasets(experimentalData, fitting,
            getPlotAxesNames(normalized), extremes);

    // show the r squared value, put the value at a certain place between the min and max dose
    double xPlace = extremes.get(1) - range;
    double yPlace = scatterXYSeries.getMinY() + ((scatterXYSeries.getMaxY() - scatterXYSeries.getMinY()) / 4);
    plot.addAnnotation(new XYTextAnnotation(
            "R2=" + AnalysisUtils.roundThreeDecimals(AnalysisUtils.computeRSquared(dataToPlot, resultsHolder)),
            xPlace, yPlace));

    // Create the chart with the plot and no legend
    JFreeChart chart = new JFreeChart("Title", JFreeChart.DEFAULT_TITLE_FONT, plot, false);
    String title = "";
    if (normalized) {
        title = "Normalized fitting";
    } else {
        title = "Initial fitting";
    }
    JFreeChartUtils.setupDoseResponseChart(chart, title);
    return chart;
}

From source file:i2p.bote.web.PeerInfoTag.java

private String createDhtChart(DhtPeerStats dhtStats) throws IOException {
    RingPlot plot;/*from  w  ww.j  a  v a  2s.c  o m*/
    int numDhtPeers = dhtStats.getData().size();
    if (numDhtPeers == 0) {
        DefaultPieDataset dataset = new DefaultPieDataset();
        dataset.setValue("", 100);

        plot = new RingPlot(dataset);
        plot.setSectionPaint("", Color.gray);
    } else {
        int reachable = 0;
        for (List<String> row : dhtStats.getData()) {
            if (_t("No").equals(row.get(4)))
                reachable += 1;
        }
        int unreachable = numDhtPeers - reachable;

        DefaultPieDataset dataset = new DefaultPieDataset();
        if (reachable > 0)
            dataset.setValue(_t("Reachable"), reachable);
        if (unreachable > 0)
            dataset.setValue(_t("Unreachable"), unreachable);

        plot = new RingPlot(dataset);
        plot.setSectionPaint(_t("Reachable"), Color.green);
        plot.setSectionPaint(_t("Unreachable"), Color.red);
    }
    plot.setLabelGenerator(null);
    plot.setShadowGenerator(null);

    JFreeChart dhtChart = new JFreeChart(_t("Kademlia Peers:"), JFreeChart.DEFAULT_TITLE_FONT, plot,
            numDhtPeers == 0 ? false : true);
    return ServletUtilities.saveChartAsPNG(dhtChart, 400, 300, null);
}

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

/**
 * Creates the chart .//from www .j av  a  2  s  .c  o m
 * 
 * @param chartTitle  the chart title.
 * @param dataset  the dataset.
 * 
 * @return A chart .
 */

public JFreeChart createChart(DatasetMap datasets) {

    Dataset dataset = (Dataset) datasets.getDatasets().get("1");

    MeterPlot plot = new MeterPlot((ValueDataset) dataset);
    plot.setRange(new Range(lower, upper));

    for (Iterator iterator = intervals.iterator(); iterator.hasNext();) {
        KpiInterval interval = (KpiInterval) iterator.next();

        plot.addInterval(new MeterInterval(interval.getLabel(), new Range(interval.getMin(), interval.getMax()),
                Color.lightGray, new BasicStroke(2.0f), interval.getColor()));
    }

    plot.setNeedlePaint(Color.darkGray);
    plot.setDialBackgroundPaint(Color.white);
    plot.setDialOutlinePaint(Color.gray);
    plot.setDialShape(DialShape.CHORD);
    plot.setMeterAngle(260);
    plot.setTickLabelsVisible(true);
    //set tick label style
    Font tickLabelsFont = new Font(labelsTickStyle.getFontName(), Font.PLAIN, labelsTickStyle.getSize());
    plot.setTickLabelFont(tickLabelsFont);
    plot.setTickLabelPaint(labelsTickStyle.getColor());
    plot.setTickSize(5.0);
    plot.setTickPaint(Color.lightGray);
    if (units != null) {
        plot.setUnits(units);
    }

    plot.setValuePaint(labelsValueStyle.getColor());
    plot.setValueFont(new Font(labelsValueStyle.getFontName(), Font.PLAIN, labelsValueStyle.getSize()));

    JFreeChart chart = new JFreeChart(name, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    chart.setBackgroundPaint(color);

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

    return chart;
}