Example usage for org.jfree.data Range Range

List of usage examples for org.jfree.data Range Range

Introduction

In this page you can find the example usage for org.jfree.data Range Range.

Prototype

public Range(double lower, double upper) 

Source Link

Document

Creates a new range.

Usage

From source file:de.unibayreuth.bayeos.goat.panels.timeseries.JPanelChart.java

/**
 * Decreases the range on the vertical axis, centered about a Java2D y coordinate.
 * <P>//from   w w w.j av  a  2s .com
 * The range on the y axis is multiplied by zoomFactor
 * 
 * @param y  the y coordinate in Java2D space.
 * @param zoomFactor  the zoomFactor < 1 == zoom in; else out.
 */
private void zoomVertical(double y, double zoomFactor) {

    JFreeChart chart = this.chartPanel.getChart();
    ChartRenderingInfo info = this.chartPanel.getChartRenderingInfo();

    if (chart.getPlot() instanceof XYPlot) {
        XYPlot vvp = (XYPlot) chart.getPlot();
        ValueAxis primYAxis = vvp.getRangeAxis();
        if (primYAxis != null) {
            double anchorValue = primYAxis.java2DToValue((float) y, info.getPlotInfo().getDataArea(),
                    vvp.getRangeAxisEdge());
            if (zoomFactor < 1.0) {
                // zoom in
                primYAxis.resizeRange(zoomFactor, anchorValue);

            } else if (zoomFactor > 1.0) {
                // zoom out
                Range range = new Range(yMin, yMax);
                adjustRange(primYAxis, range, zoomFactor, anchorValue);
            }
        }

    }
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.PeakListChartPanel.java

public void updateMZAxis() {
    if (theDocument.size() > 0)
        thePlot.getDomainAxis().setRange(theDocument.getMZRange());
    else/*from  ww  w  . java2 s . c  o  m*/
        thePlot.getDomainAxis().setRange(new Range(0., 1.));
}

From source file:com.graphhopper.jsprit.analysis.toolbox.Plotter.java

private Range getDomainRange(final XYSeriesCollection seriesCol) {
    if (this.boundingBox == null)
        return seriesCol.getDomainBounds(true);
    else//w  w  w.  j a v a  2s  .  c  o m
        return new Range(boundingBox.minX, boundingBox.maxX);
}

From source file:org.jax.pubarray.server.restful.GraphingResource.java

/**
 * Create a graph for the given configuration
 * @param graphConfiguration/*from w  ww . j av  a2  s  . c  o  m*/
 *          the key
 * @return
 *          the graph
 */
@SuppressWarnings("unchecked")
private JFreeChart createProbeIntensityGraph(ProbeIntensityGraphConfiguration graphConfiguration) {
    try {
        Connection connection = this.getConnection();

        String[] probeIds = graphConfiguration.getProbeIds();
        double[][] probeDataRows = new double[probeIds.length][];
        for (int i = 0; i < probeIds.length; i++) {
            probeDataRows[i] = this.persistenceManager.getDataRowForProbeID(connection, probeIds[i]);
        }

        TableColumnMetadata orderBy = graphConfiguration.getOrderProbesBy();
        final List<Comparable> orderByItems;
        if (orderBy != null) {
            LOG.info("We are ordering by: " + orderBy);
            orderByItems = this.persistenceManager.getDesignDataColumn(connection, orderBy);
        } else {
            orderByItems = null;
        }

        TableMetadata metadata = this.persistenceManager.getDataTableMetadata(connection);
        final CategoryDataset categoryDataset;
        if (graphConfiguration.getGroupReplicates()) {
            switch (graphConfiguration.getGroupedGraphType()) {
            case BOX_PLOT: {
                categoryDataset = new DefaultBoxAndWhiskerCategoryDataset();
            }
                break;

            case SCATTER_PLOT: {
                categoryDataset = new DefaultMultiValueCategoryDataset();
            }
                break;

            default:
                throw new IllegalArgumentException(
                        "don't know how to deal with plot type: " + graphConfiguration.getGroupedGraphType());
            }
        } else {
            categoryDataset = new DefaultCategoryDataset();
        }

        // iterate through all of the selected probesets
        List<QualifiedColumnMetadata> termsOfInterest = Arrays.asList(graphConfiguration.getTermsOfInterest());
        for (int rowIndex = 0; rowIndex < probeDataRows.length; rowIndex++) {
            double[] currRow = probeDataRows[rowIndex];
            assert currRow.length == metadata.getColumnMetadata().length - 1;

            // should we log2 transform the data?
            if (graphConfiguration.getLog2TransformData()) {
                for (int i = 0; i < currRow.length; i++) {
                    currRow[i] = Math.log(currRow[i]) / LOG2_FACTOR;
                }
            }

            // iterate through the columns in the data table (each column
            // represents a different array)
            List<ComparableContainer<Double, Comparable>> rowElemList = new ArrayList<ComparableContainer<Double, Comparable>>();
            for (int colIndex = 0; colIndex < currRow.length; colIndex++) {
                // we use +1 indexing here because we want to skip over
                // the probesetId metadata and get right to the
                // array intensity metadata
                TableColumnMetadata colMeta = metadata.getColumnMetadata()[colIndex + 1];

                // check to see if we need to skip this data
                if (!graphConfiguration.getIncludeDataFromAllArrays()) {
                    // if it's one of the "terms of interest" we will keep
                    // it. we're using a brute force search here
                    boolean keepThisOne = false;
                    for (QualifiedColumnMetadata termOfInterest : termsOfInterest) {
                        if (termOfInterest.getTableName().equals(metadata.getTableName())
                                && termOfInterest.getName().equals(colMeta.getName())) {
                            keepThisOne = true;
                            break;
                        }
                    }

                    if (!keepThisOne) {
                        continue;
                    }
                }

                final String columnName = colMeta.getName();
                final Comparable columnKey;
                if (orderByItems == null) {
                    columnKey = columnName;
                } else {
                    // the ordering will be done on the selected
                    // "order by" design criteria
                    columnKey = new ComparableContainer<String, Comparable>(columnName,
                            orderByItems.get(colIndex), !graphConfiguration.getGroupReplicates());

                    // TODO remove me!!!!
                    System.out.println("For array " + columnName + " the order by " + "value is: "
                            + orderByItems.get(colIndex));
                    // end of remove me
                }

                rowElemList
                        .add(new ComparableContainer<Double, Comparable>(currRow[colIndex], columnKey, false));
            }

            Collections.sort(rowElemList);

            if (graphConfiguration.getGroupReplicates()) {
                switch (graphConfiguration.getGroupedGraphType()) {
                case BOX_PLOT: {
                    DefaultBoxAndWhiskerCategoryDataset dataset = (DefaultBoxAndWhiskerCategoryDataset) categoryDataset;
                    for (int i = 0; i < rowElemList.size(); i++) {
                        List<Double> groupList = new ArrayList<Double>();
                        groupList.add(rowElemList.get(i).getElement());
                        Comparable colKey = rowElemList.get(i).getComparable();

                        i++;
                        for (; i < rowElemList.size()
                                && rowElemList.get(i).getComparable().equals(colKey); i++) {
                            groupList.add(rowElemList.get(i).getElement());
                        }
                        i--;

                        dataset.add(groupList, probeIds[rowIndex], colKey);
                    }
                }
                    break;

                case SCATTER_PLOT: {
                    DefaultMultiValueCategoryDataset dataset = (DefaultMultiValueCategoryDataset) categoryDataset;
                    for (int i = 0; i < rowElemList.size(); i++) {
                        List<Double> groupList = new ArrayList<Double>();
                        groupList.add(rowElemList.get(i).getElement());
                        Comparable colKey = rowElemList.get(i).getComparable();

                        i++;
                        for (; i < rowElemList.size()
                                && rowElemList.get(i).getComparable().equals(colKey); i++) {
                            groupList.add(rowElemList.get(i).getElement());
                        }
                        i--;

                        dataset.add(groupList, probeIds[rowIndex], colKey);
                    }
                }
                    break;
                }
            } else {
                DefaultCategoryDataset dataset = (DefaultCategoryDataset) categoryDataset;
                for (ComparableContainer<Double, Comparable> rowElem : rowElemList) {
                    dataset.addValue(rowElem.getElement(), probeIds[rowIndex], rowElem.getComparable());
                }
            }
        }

        CategoryAxis xAxis = new CategoryAxis();
        if (graphConfiguration.getGroupReplicates() && orderBy != null) {
            xAxis.setLabel(orderBy.getName());
        } else {
            if (orderBy != null) {
                xAxis.setLabel("Arrays (Ordered By " + orderBy.getName() + ")");
            } else {
                xAxis.setLabel("Arrays");
            }
        }
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);

        final NumberAxis yAxis;
        if (graphConfiguration.getLog2TransformData()) {
            yAxis = new NumberAxis("log2(Intensity)");
        } else {
            yAxis = new NumberAxis("Intensity");
        }
        yAxis.setAutoRange(true);
        yAxis.setAutoRangeIncludesZero(false);

        // TODO: this is a HACK to deal with auto-range bug in JFreeChart
        //       which occurs when doing the grouped scatter plot
        if (graphConfiguration.getGroupReplicates()
                && graphConfiguration.getGroupedGraphType() == GroupedGraphType.SCATTER_PLOT) {
            double minVal = Double.POSITIVE_INFINITY;
            double maxVal = Double.NEGATIVE_INFINITY;
            for (double[] dataRow : probeDataRows) {
                for (double datum : dataRow) {
                    if (datum > maxVal) {
                        maxVal = datum;
                    }

                    if (datum < minVal) {
                        minVal = datum;
                    }
                }

                if (minVal != Double.POSITIVE_INFINITY && maxVal != Double.NEGATIVE_INFINITY
                        && minVal != maxVal) {
                    yAxis.setAutoRange(false);

                    double margin = (maxVal - minVal) * 0.02;
                    Range yRange = new Range(minVal - margin, maxVal + margin);
                    yAxis.setRange(yRange);
                }
            }
        }
        // END HACK

        final CategoryItemRenderer renderer;
        if (graphConfiguration.getGroupReplicates()) {
            switch (graphConfiguration.getGroupedGraphType()) {
            case BOX_PLOT: {
                BoxAndWhiskerRenderer boxRenderer = new BoxAndWhiskerRenderer();
                boxRenderer.setMaximumBarWidth(0.03);
                renderer = boxRenderer;
            }
                break;

            case SCATTER_PLOT: {
                renderer = new ScatterRenderer();
            }
                break;

            default:
                throw new IllegalArgumentException(
                        "don't know how to deal with plot type: " + graphConfiguration.getGroupedGraphType());
            }
        } else {
            renderer = new LineAndShapeRenderer();
        }
        Plot plot = new CategoryPlot(categoryDataset, xAxis, yAxis, renderer);

        return new JFreeChart("Intensity Values", plot);
    } catch (SQLException ex) {
        LOG.log(Level.SEVERE, "failed to generate image", ex);
        return null;
    }
}

From source file:com.rapidminer.gui.plotter.charts.SeriesChartPlotter.java

private void setYAxisRange(NumberAxis axis) {
    Range range = getRangeForName(VALUEAXIS_LABEL);
    if (range == null) {
        for (int c = 0; c < this.dataTable.getNumberOfColumns(); c++) {
            if (this.columns[c] || c == getAxis(0) || c == getAxis(1)) {
                if (range == null) {
                    range = getRangeForDimension(c);
                } else {
                    Range newRange = getRangeForDimension(c);
                    if (newRange != null) {
                        range = new Range(
                                MathFunctions.robustMin(range.getLowerBound(), newRange.getLowerBound()),
                                MathFunctions.robustMax(range.getUpperBound(), newRange.getUpperBound()));
                    }//from ww w . j  av a 2 s  .c  o m
                }
            }
        }
    }
    if (range != null) {
        axis.setRange(range);
    } else {
        axis.setAutoRange(true);
        axis.setAutoRangeStickyZero(false);
        axis.setAutoRangeIncludesZero(false);
    }
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.PeakListChartPanel.java

public void updateIntensityAxis() {
    double max_int = 0.;
    for (int d = 0; d < thePlot.getDatasetCount(); d++) {
        XYDataset dataset = thePlot.getDataset(d);
        for (int s = 0; s < dataset.getSeriesCount(); s++)
            for (int i = 0; i < dataset.getItemCount(s); i++)
                max_int = Math.max(max_int, dataset.getYValue(s, i));
    }/*from w  w w .  j a  v  a  2 s. com*/

    if (max_int == 0.) {
        // no data
        return;
    }
    Range new_int_range = new Range(0., max_int);

    // make space for annotations
    Rectangle2D data_area = theChartPanel.getScreenDataArea();
    if (data_area.getHeight() > 0)
        new_int_range = Range.expand(new_int_range, 0., 12. / data_area.getHeight());
    thePlot.getRangeAxis().setRange(new_int_range);
}

From source file:asl.util.PlotMaker.java

public void plotCoherence(double per[], double[] gamma, String plotString) {

    final String plotTitle = String.format("%04d%03d.%s.%s-%s", date.get(Calendar.YEAR),
            date.get(Calendar.DAY_OF_YEAR), station, channelX, channelY);
    final String pngName = String.format("%s/%04d%03d.%s.%s-%s.%s.png", outputDir, date.get(Calendar.YEAR),
            date.get(Calendar.DAY_OF_YEAR), station, channelX, channelY, plotString);

    File outputFile = new File(pngName);

    // Check that we will be able to output the file without problems and if not --> return
    if (!checkFileOut(outputFile)) {
        System.out.format("== plotCoherence: request to output plot=[%s] but we are unable to create it "
                + " --> skip plot\n", pngName);
        return;/*from  w  w w  . j a va2  s.  com*/
    }

    final String legend = String.format("%s--%s", channelX, channelY);
    final XYSeries series1 = new XYSeries(legend);

    for (int k = 0; k < gamma.length; k++) {
        series1.add(per[k], gamma[k]);
    }

    //final XYItemRenderer renderer1 = new StandardXYItemRenderer();
    final XYLineAndShapeRenderer renderer1 = new XYLineAndShapeRenderer();
    Rectangle rectangle = new Rectangle(3, 3);
    renderer1.setSeriesShape(0, rectangle);
    renderer1.setSeriesShapesVisible(0, true);
    renderer1.setSeriesLinesVisible(0, false);

    Paint[] paints = new Paint[] { Color.red, Color.black };
    renderer1.setSeriesPaint(0, paints[0]);

    final NumberAxis rangeAxis1 = new NumberAxis("Coherence, Gamma");
    rangeAxis1.setRange(new Range(0, 1.2));
    rangeAxis1.setTickUnit(new NumberTickUnit(0.1));

    final LogarithmicAxis horizontalAxis = new LogarithmicAxis("Period (sec)");
    horizontalAxis.setRange(new Range(0.05, 10000));

    final XYSeriesCollection seriesCollection = new XYSeriesCollection();
    seriesCollection.addSeries(series1);

    final XYPlot xyplot = new XYPlot((XYDataset) seriesCollection, horizontalAxis, rangeAxis1, renderer1);

    xyplot.setDomainGridlinesVisible(true);
    xyplot.setRangeGridlinesVisible(true);
    xyplot.setRangeGridlinePaint(Color.black);
    xyplot.setDomainGridlinePaint(Color.black);

    final JFreeChart chart = new JFreeChart(xyplot);
    chart.setTitle(new TextTitle(plotTitle));

    try {
        ChartUtilities.saveChartAsPNG(outputFile, chart, 500, 300);
    } catch (IOException e) {
        System.err.println("Problem occurred creating chart.");

    }
}

From source file:com.rapidminer.gui.plotter.charts.HistogramChart.java

private void setRange(ValueAxis axis) {
    Range range = null;//w  w w  .  ja v  a  2 s.c  o m
    for (int c = 0; c < this.dataTable.getNumberOfColumns(); c++) {
        if (this.columns[c]) {
            if (range == null) {
                range = getRangeForDimension(c);
            } else {
                Range newRange = getRangeForDimension(c);
                if (newRange != null) {
                    range = new Range(MathFunctions.robustMin(range.getLowerBound(), newRange.getLowerBound()),
                            MathFunctions.robustMax(range.getUpperBound(), newRange.getUpperBound()));
                }
            }
        }
    }
    if (range != null) {
        axis.setRange(range);
    } else {
        axis.setAutoRange(true);
    }
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.PeakAnnotationCalibrationPanel.java

public void onZoomNone() {
    if (!isChartEmpty()) {
        Range mz_range = theDocument.getMZRange();
        if (mz_range.getLength() == 0.)
            mz_range = new Range(mz_range.getLowerBound() - 10, mz_range.getLowerBound() + 10);
        thePlot.getDomainAxis().setRange(mz_range);

        if (accuracy_unit.equals("da")) {
            Range acc_range = theDocument.getAccuracyRange(current_ind);
            if (acc_range.getLength() == 0.)
                acc_range = new Range(acc_range.getLowerBound() - 0.1, acc_range.getLowerBound() + 0.1);
            thePlot.getRangeAxis().setRange(acc_range);
        } else {/*from   ww w .  java2  s. c om*/
            Range acc_range = theDocument.getAccuracyRangePPM(current_ind);
            if (acc_range.getLength() == 0.)
                acc_range = new Range(acc_range.getLowerBound() - 100, acc_range.getLowerBound() + 100);
            thePlot.getRangeAxis().setRange(acc_range);
        }
    } else {
        thePlot.getDomainAxis().setRange(new Range(0., 1.));
        if (accuracy_unit.equals("da"))
            thePlot.getRangeAxis().setRange(new Range(-1., 1.));
        else
            thePlot.getRangeAxis().setRange(new Range(-1000., 1000.));
    }
}

From source file:org.pentaho.platform.uifoundation.chart.DialWidgetDefinition.java

/**
 * Create a dial definition object from an XML document
 * //  w w w  .j  a  v  a  2s .c  o  m
 * @param doc
 *          definition XML document
 * @return Dial definition object
 */
public static void createDial(final DialWidgetDefinition widgetDefinition, final Node dialNode, final int width,
        final int height, final IPentahoSession session) {

    Node node = dialNode.selectSingleNode("units"); //$NON-NLS-1$
    if (node != null) {
        String units = node.getText();
        widgetDefinition.setUnits(units);
    }

    // set the background Paint
    Paint paint = JFreeChartEngine.getPaint(dialNode.selectSingleNode("background-color")); //$NON-NLS-1$
    if (paint == null) {
        Element backgroundNode = (Element) dialNode.selectSingleNode("chart-background"); //$NON-NLS-1$
        if (backgroundNode != null) {
            String backgroundType = backgroundNode.attributeValue("type"); //$NON-NLS-1$
            if ("texture".equals(backgroundType)) { //$NON-NLS-1$
                paint = JFreeChartEngine.getTexturePaint(backgroundNode, width, height, session);
            } else if ("gradient".equals(backgroundType)) { //$NON-NLS-1$
                paint = JFreeChartEngine.getGradientPaint(backgroundNode, width, height);
            }
        }
    } else {
        // log a deprecation warning for background-color ...
        DialWidgetDefinition.getLogger().warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_PROPERTY", //$NON-NLS-1$
                "background-color", "chart-background")); //$NON-NLS-1$ //$NON-NLS-2$    
        DialWidgetDefinition.getLogger().warn(
                Messages.getInstance().getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", "background-color")); //$NON-NLS-1$ //$NON-NLS-2$     
    }

    if (paint != null) {
        widgetDefinition.setChartBackgroundPaint(paint);
    }

    // set the dial background Paint
    paint = JFreeChartEngine.getPaint(dialNode.selectSingleNode("plot-background-color")); //$NON-NLS-1$
    if (paint == null) {
        Element backgroundNode = (Element) dialNode.selectSingleNode("plot-background"); //$NON-NLS-1$
        if (backgroundNode != null) {
            String backgroundType = backgroundNode.attributeValue("type"); //$NON-NLS-1$
            if ("texture".equals(backgroundType)) { //$NON-NLS-1$
                paint = JFreeChartEngine.getTexturePaint(backgroundNode, width, height, session);
            } else if ("gradient".equals(backgroundType)) { //$NON-NLS-1$
                paint = JFreeChartEngine.getGradientPaint(backgroundNode, width, height);
            }
        }
    } else {
        // log a deprecation warning for plot-background-color ...
        DialWidgetDefinition.getLogger().warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_PROPERTY", //$NON-NLS-1$
                "plot-background-color", "plot-background")); //$NON-NLS-1$ //$NON-NLS-2$    
        DialWidgetDefinition.getLogger().warn(Messages.getInstance()
                .getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", "plot-background-color")); //$NON-NLS-1$ //$NON-NLS-2$     
    }

    if (paint != null) {
        widgetDefinition.setPlotBackgroundPaint(paint);
    }

    // set the needle Paint
    paint = JFreeChartEngine.getPaint(dialNode.selectSingleNode("needle-color")); //$NON-NLS-1$
    if (paint != null) {
        widgetDefinition.setNeedlePaint(paint);
    }

    // set the tick Paint
    paint = JFreeChartEngine.getPaint(dialNode.selectSingleNode("tick-color")); //$NON-NLS-1$
    if (paint != null) {
        widgetDefinition.setTickPaint(paint);
    }

    Node tmpNode = dialNode.selectSingleNode("tick-interval"); //$NON-NLS-1$
    if (tmpNode != null) {
        widgetDefinition.setTickSize(Integer.parseInt(dialNode.selectSingleNode("tick-interval").getText())); //$NON-NLS-1$
    }

    // set the value Paint
    paint = JFreeChartEngine.getPaint(dialNode.selectSingleNode("value-color")); //$NON-NLS-1$
    if (paint != null) {
        widgetDefinition.setValuePaint(paint);
    }

    // TODO get this from the XML document
    widgetDefinition.setDialShape(DialShape.CHORD);

    Node titleFontNode = dialNode.selectSingleNode("title-font"); //$NON-NLS-1$
    if (titleFontNode != null) {
        Node fontNode = titleFontNode.selectSingleNode("font"); //$NON-NLS-1$
        if (fontNode != null) {
            String titleFontStr = fontNode.getText().trim();
            if (!"".equals(titleFontStr)) { //$NON-NLS-1$
                Node titleFontSizeNode = titleFontNode.selectSingleNode("size"); //$NON-NLS-1$
                int size = titleFontSizeNode != null ? Integer.parseInt(titleFontSizeNode.getText()) : 12;
                widgetDefinition.setTitleFont(new Font(titleFontStr, Font.BOLD, size));
            }
        } else {
            String titleFontStr = titleFontNode.getText().trim();
            if (!"".equals(titleFontStr)) { //$NON-NLS-1$
                widgetDefinition.setTitleFont(new Font(titleFontStr, Font.ITALIC, 24));
            }
        }
    }

    Node valueFontNode = dialNode.selectSingleNode("domain-tick-font"); //$NON-NLS-1$
    if (valueFontNode != null) {
        Node fontNode = valueFontNode.selectSingleNode("font"); //$NON-NLS-1$
        if (fontNode != null) {
            String fontStr = fontNode.getText().trim();
            if (!"".equals(fontStr)) { //$NON-NLS-1$
                Node valueFontSizeNode = valueFontNode.selectSingleNode("size"); //$NON-NLS-1$
                int size = valueFontSizeNode != null ? Integer.parseInt(valueFontSizeNode.getText()) : 12;
                widgetDefinition.setValueFont(new Font(fontStr, Font.BOLD, size));
            }
        } else {
            String fontStr = valueFontNode.getText().trim();
            if (!"".equals(fontStr)) { //$NON-NLS-1$
                widgetDefinition.setValueFont(new Font(fontStr, Font.ITALIC, 24));
            }
        }
    }

    // set any intervals that are defined in the document

    // A list of interval nodes should not be allowed to exist as a child of the main XML element (for XML schema
    // to
    // be well constructed and validate the XML .
    // We have deprecated <interval> as a child of the main node , and now require an <intervals> parent node
    // under which <intervals> can exist.

    List intervals = dialNode.selectNodes("interval"); //$NON-NLS-1$

    if ((intervals == null) || (intervals.isEmpty())) {
        Node intervalsNode = dialNode.selectSingleNode("intervals"); //$NON-NLS-1$
        if (intervalsNode != null) {
            intervals = intervalsNode.selectNodes("interval"); //$NON-NLS-1$
        }
    } else {
        // log a deprecation warning for this property...
        DialWidgetDefinition.getLogger()
                .warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_CHILD", "interval", "intervals")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$    
        DialWidgetDefinition.getLogger()
                .warn(Messages.getInstance().getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", "interval")); //$NON-NLS-1$ //$NON-NLS-2$     
    }

    if (intervals != null) {

        Iterator intervalIterator = intervals.iterator();
        while (intervalIterator.hasNext()) {
            // get the interval node
            Node intervalNode = (Node) intervalIterator.next();

            // get the interval name
            String label = intervalNode.selectSingleNode("label").getText(); //$NON-NLS-1$

            // get the range of the interval
            double minimum = Double.parseDouble(intervalNode.selectSingleNode("minimum").getText()); //$NON-NLS-1$
            double maximum = Double.parseDouble(intervalNode.selectSingleNode("maximum").getText()); //$NON-NLS-1$
            Range range = new Range(minimum, maximum);

            Paint backgroundPaint = JFreeChartEngine.getPaint(intervalNode.selectSingleNode("color")); //$NON-NLS-1$
            if (backgroundPaint == null) {
                Element backgroundNode = (Element) intervalNode.selectSingleNode("interval-background"); //$NON-NLS-1$
                if (backgroundNode != null) {
                    String backgroundType = backgroundNode.attributeValue("type"); //$NON-NLS-1$
                    if ("texture".equals(backgroundType)) { //$NON-NLS-1$
                        backgroundPaint = JFreeChartEngine.getTexturePaint(backgroundNode, width, height,
                                session);
                    } else if ("gradient".equals(backgroundType)) { //$NON-NLS-1$
                        backgroundPaint = JFreeChartEngine.getGradientPaint(backgroundNode, width, height);
                    }
                }
            }

            // get the text color of the interval
            String textColor = intervalNode.selectSingleNode("text-color").getText(); //$NON-NLS-1$
            Stroke outlineStroke;
            if (intervalNode.selectSingleNode("stroke-width") != null) { //$NON-NLS-1$
                outlineStroke = new BasicStroke(
                        Float.parseFloat(intervalNode.selectSingleNode("stroke-width").getText())); //$NON-NLS-1$
            } else {
                outlineStroke = new BasicStroke();
            }
            Paint outlinePaint = JFreeChartEngine.getPaint(textColor);

            // create the interval object
            MeterInterval interval = new MeterInterval(label, range, outlinePaint, outlineStroke,
                    backgroundPaint);

            // add the interval to the widget
            widgetDefinition.addInterval(interval);
        }
    }

    // get the chart subtitles

    // A list of <subtitle> nodes should not be allowed to exist as a child of the main XML element (for XML schema
    // to
    // be well constructed and validate the XML .
    // We have deprecated <subtitle> as a child of the main node , and now require a <subtitles> parent node
    // under which <subtitle> can exist.

    List subtitles = dialNode.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME);

    if ((subtitles == null) || (subtitles.isEmpty())) {
        Node subTitlesNode = dialNode.selectSingleNode(ChartDefinition.SUBTITLES_NODE_NAME);
        if (subTitlesNode != null) {
            subtitles = subTitlesNode.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME);
        }
    } else {
        // log a deprecation warning for this property...
        DialWidgetDefinition.getLogger().warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_CHILD", //$NON-NLS-1$
                ChartDefinition.SUBTITLE_NODE_NAME, ChartDefinition.SUBTITLES_NODE_NAME));
        DialWidgetDefinition.getLogger().warn(Messages.getInstance()
                .getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", ChartDefinition.SUBTITLE_NODE_NAME)); //$NON-NLS-1$  
    }

    if (subtitles != null) {
        widgetDefinition.addSubTitles(subtitles);
    }

}