Example usage for org.jfree.chart.plot XYPlot XYPlot

List of usage examples for org.jfree.chart.plot XYPlot XYPlot

Introduction

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

Prototype

public XYPlot() 

Source Link

Document

Creates a new XYPlot instance with no dataset, no axes and no renderer.

Usage

From source file:playground.dgrether.analysis.charts.DgAvgDeltaUtilsGroupChart.java

public JFreeChart createChart() {
    XYPlot plot = new XYPlot();
    ValueAxis xAxis = this.axisBuilder.createValueAxis("Income [Chf / Year]");
    ValueAxis yAxis = this.axisBuilder.createValueAxis("Delta Utils [Utils]");
    plot.setDomainAxis(xAxis);//from  w  w w.jav a2 s.c  om
    plot.setRangeAxis(yAxis);

    DgColorScheme colorScheme = new DgColorScheme();

    XYItemRenderer renderer2;
    renderer2 = new XYLineAndShapeRenderer(true, true);
    renderer2.setSeriesItemLabelsVisible(0, true);
    renderer2.setSeriesItemLabelGenerator(0, this.labelGenerator);
    plot.setDataset(0, this.dataset);
    renderer2.setSeriesStroke(0, new BasicStroke(2.0f));
    renderer2.setSeriesOutlineStroke(0, new BasicStroke(3.0f));
    renderer2.setSeriesPaint(0, colorScheme.getColor(1, "a"));
    plot.setRenderer(0, renderer2);

    JFreeChart chart = new JFreeChart("", plot);
    chart.setBackgroundPaint(ChartColor.WHITE);
    chart.getLegend().setItemFont(this.axisBuilder.getAxisFont());
    chart.setTextAntiAlias(true);
    return chart;
}

From source file:de.bund.bfr.knime.pmmlite.views.chart.ChartCreator.java

public JFreeChart getChart(List<String> idsToPaint) throws ParseException, UnitException {
    if (varX == null || varY == null || varX.getName() == null || varY.getName() == null) {
        return new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, new XYPlot(), showLegend);
    }//from   ww  w.  java2  s.  c o  m

    NumberAxis xAxis = new NumberAxis(varX.getDisplayString());
    NumberAxis yAxis = new NumberAxis(varY.getDisplayString());
    XYPlot plot = new XYPlot(null, xAxis, yAxis, null);
    double usedMinX = Double.POSITIVE_INFINITY;
    double usedMaxX = Double.NEGATIVE_INFINITY;
    int index = 0;
    List<Color> defaultColors = ChartUtils.createColorList(idsToPaint.size());
    List<NamedShape> defaultShapes = ChartUtils.createShapeList(idsToPaint.size());

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

        if (plotable == null) {
            continue;
        }

        if (plotable.getType() == Plotable.Type.BOTH || plotable.getType() == Plotable.Type.BOTH_MANY
                || plotable.getType() == Plotable.Type.FUNCTION
                || plotable.getType() == Plotable.Type.FUNCTION_SAMPLE) {
            double minArg = varX.to(MathUtils.nullToNan(plotable.getMinValues().get(varX.getName())),
                    plotable.getUnits().get(varX.getName()));
            double maxArg = varX.to(MathUtils.nullToNan(plotable.getMaxValues().get(varX.getName())),
                    plotable.getUnits().get(varX.getName()));

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

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

        if (plotable.getType() == Plotable.Type.BOTH || plotable.getType() == Plotable.Type.BOTH_MANY) {
            for (Map<String, Integer> choice : plotable.getAllChoices(varX.getName())) {
                double[][] points = plotable.getPoints(varX, varY, choice);

                if (points != null) {
                    for (int i = 0; i < points[0].length; i++) {
                        usedMinX = Math.min(usedMinX, points[0][i]);
                        usedMaxX = Math.max(usedMaxX, points[0][i]);
                    }
                }
            }
        }

        if (plotable.getType() == Plotable.Type.DATASET || plotable.getType() == Plotable.Type.DATASET_MANY) {
            double[][] points = plotable.getPoints(varX, varY);

            if (points != null) {
                for (int i = 0; i < points[0].length; i++) {
                    usedMinX = Math.min(usedMinX, points[0][i]);
                    usedMaxX = Math.max(usedMaxX, points[0][i]);
                }
            }
        }

        if (plotable.getType() == Plotable.Type.FUNCTION_SAMPLE) {
            for (Double x : plotable.getSamples()) {
                if (x != null && Double.isFinite(x)) {
                    usedMinX = Math.min(usedMinX, x);
                    usedMaxX = Math.max(usedMaxX, x);
                }
            }
        }
    }

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

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

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

    if (varY.getName().equals(PmmUtils.TIME) || varY.getName().equals(PmmUtils.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));
    }

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

        if (plotable == null) {
            continue;
        }

        plotable.setFunctionSteps(resolution);

        switch (plotable.getType()) {
        case DATASET:
            plotDataSet(plot, plotable, id, defaultColors.get(index), defaultShapes.get(index));
            break;
        case DATASET_MANY:
            plotDataSetStrict(plot, plotable, id);
            break;
        case FUNCTION:
            plotFunction(plot, plotable, id, defaultColors.get(index), defaultShapes.get(index), usedMinX,
                    usedMaxX);
            break;
        case FUNCTION_SAMPLE:
            plotFunctionSample(plot, plotable, id, defaultColors.get(index), defaultShapes.get(index), usedMinX,
                    usedMaxX);
            break;
        case BOTH:
            plotBoth(plot, plotable, id, defaultColors.get(index), defaultShapes.get(index), usedMinX,
                    usedMaxX);
            break;
        case BOTH_MANY:
            plotBothStrict(plot, plotable, id, usedMinX, usedMaxX);
            break;
        default:
            throw new RuntimeException("Unknown type of plotable: " + plotable.getType());
        }

        index++;
    }

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

From source file:jgnash.ui.commodity.SecuritiesHistoryDialog.java

private void initComponents() {
    dateField = new DatePanel();
    closeField = new JFloatField();
    lowField = new JFloatField();
    highField = new JFloatField();
    securityCombo = new SecurityComboBox();
    volumeField = new JIntegerField();

    updateButton = new JButton(rb.getString("Button.UpdateOnline"),
            IconUtils.getIcon("/jgnash/resource/applications-internet.png"));

    deleteButton = new JButton(rb.getString("Button.Delete"));
    clearButton = new JButton(rb.getString("Button.Clear"));
    applyButton = new JButton(rb.getString("Button.Add"));
    closeButton = new JButton(rb.getString("Button.Close"));

    model = new HistoryModel();

    table = new HistoryTable();
    table.setModel(model);/*ww w.  ja va 2  s.  c  o m*/
    table.setPreferredScrollableViewportSize(new Dimension(150, 120));
    table.setCellSelectionEnabled(false);
    table.setColumnSelectionAllowed(false);
    table.setRowSelectionAllowed(true);
    table.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    table.setRowSorter(new TableRowSorter<>(model));
    table.setFillsViewportHeight(true);

    // create an empty chart for panel construction
    chartPanel = new ChartPanel(new JFreeChart(new XYPlot()));
    chartPanel.setPreferredSize(new Dimension(150, 90));

    applyButton.addActionListener(this);
    clearButton.addActionListener(this);
    deleteButton.addActionListener(this);
    updateButton.addActionListener(this);
    securityCombo.addActionListener(this);
    closeButton.addActionListener(this);
}

From source file:ec.nbdemetra.ui.chart3d.functions.Functions2DChart.java

private JFreeChart createChart() {
    XYPlot plot = new XYPlot();

    plot.setDataset(0, Charts.emptyXYDataset());
    plot.setRenderer(0, functionRenderer);
    plot.mapDatasetToDomainAxis(0, 0);/*from   w  w w .  ja  va2 s .  c om*/
    plot.mapDatasetToRangeAxis(0, 0);

    plot.setDataset(1, Charts.emptyXYDataset());
    plot.setRenderer(1, optimumRenderer);
    plot.mapDatasetToDomainAxis(1, 0);
    plot.mapDatasetToRangeAxis(1, 0);

    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

    JFreeChart result = new JFreeChart("", TsCharts.CHART_TITLE_FONT, plot, false);

    LegendTitle legend = new LegendTitle(result.getPlot());
    legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
    legend.setFrame(new LineBorder());
    legend.setBackgroundPaint(Color.white);
    legend.setPosition(RectangleEdge.BOTTOM);
    result.addLegend(legend);

    result.setPadding(TsCharts.CHART_PADDING);
    return result;
}

From source file:ch.algotrader.client.chart.ChartTab.java

public void init(ChartDefinitionVO chartDefinition) {

    // remove all components first
    this.removeAll();

    resetPopupMenu();//w w w  .ja  v a 2s .  com

    this.chartDefinition = chartDefinition;

    // create the plot
    XYPlot plot = new XYPlot();

    // add gridlines
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinesVisible(true);

    // create the JFreeChart
    JFreeChart chart = new JFreeChart(plot);
    this.setChart(chart);

    // init the maps
    this.bars = new HashMap<>();
    this.indicators = new HashMap<>();
    this.markers = new HashMap<>();
    this.markersSelectionStatus = new HashMap<>();

    // init domain axis
    initDomainAxis(chartDefinition);

    // init range axis
    initRangeAxis(chartDefinition);

    // create a subtitle
    TextTitle title = new TextTitle();
    title.setFont(new Font("SansSerif", 0, 9));
    chart.addSubtitle(title);

    // crosshair
    plot.setDomainCrosshairVisible(true);
    plot.setDomainCrosshairLockedOnData(true);
    plot.setRangeCrosshairVisible(true);
    plot.setDomainCrosshairLockedOnData(true);
}

From source file:org.operamasks.faces.render.graph.CompositeChartRenderer.java

private JFreeChart createXYCompositeChart(List<JFreeChart> subcharts, UIChart comp) {
    XYPlot compositePlot = new XYPlot();
    compositePlot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    compositePlot.setOrientation(getChartOrientation(comp));

    for (int i = 0; i < subcharts.size(); i++) {
        XYPlot subplot = (XYPlot) subcharts.get(i).getPlot();
        compositePlot.setDataset(i, subplot.getDataset());
        compositePlot.setRenderer(i, subplot.getRenderer());

        if (i == 0) {
            compositePlot.setDomainAxis(0, subplot.getDomainAxis());
            compositePlot.setRangeAxis(0, subplot.getRangeAxis());
        } else {/*from ww w. j a va  2  s  .  co m*/
            int yAxisMap = getRangeAxisMap(comp, i);
            ValueAxis yAxis = null;
            if (yAxisMap == -1) {
                yAxisMap = 0; // map to axis zero by default
            } else if (yAxisMap == i) {
                yAxis = subplot.getRangeAxis(); // add subplot axis to composite plot
            }
            compositePlot.setRangeAxis(i, yAxis);
            compositePlot.mapDatasetToRangeAxis(i, yAxisMap);
        }
    }

    return new JFreeChart(null, null, compositePlot, false);
}

From source file:com.griddynamics.jagger.reporting.chart.ChartHelper.java

public static JFreeChart createStackedAreaChart(String title, XYSeriesCollection areaData,
        XYSeriesCollection lineData, String xLabel, String yLabel, ColorTheme theme) {

    final ValueAxis xAxis = new NumberAxis(xLabel);
    final ValueAxis yAxis = new NumberAxis(yLabel);
    XYPlot mainPlot = new XYPlot();
    mainPlot.setDomainAxis(xAxis);//from   w  ww . ja v  a 2 s . c o m
    mainPlot.setRangeAxis(yAxis);

    mainPlot.setForegroundAlpha(0.9f);

    //[ stacked area
    DefaultTableXYDataset areaDs = new DefaultTableXYDataset();
    for (int i = 0; i < areaData.getSeriesCount(); i++) {
        areaDs.addSeries(areaData.getSeries(i));
    }
    XYItemRenderer stackedRenderer = new StackedXYAreaRenderer2();
    mainPlot.setDataset(areaDs);
    mainPlot.setRenderer(stackedRenderer);

    Color[] colors = generateJetSpectrum(areaData.getSeriesCount());
    for (int i = 0; i < areaData.getSeriesCount(); i++) {
        stackedRenderer.setSeriesPaint(i, colors[i]);
    }
    //]

    //[ lines
    if (lineData != null) {
        XYItemRenderer lineRenderer = new StandardXYItemRenderer();
        DefaultTableXYDataset lineDs = new DefaultTableXYDataset();
        for (int i = 0; i < lineData.getSeriesCount(); i++) {
            lineDs.addSeries(lineData.getSeries(i));
        }
        mainPlot.setDataset(1, lineDs);
        mainPlot.setRenderer(1, lineRenderer);

        colors = new Color[] { Color.black, Color.red, Color.darkGray };
        for (int i = 0; i < lineData.getSeriesCount(); i++) {
            lineRenderer.setSeriesPaint(i, colors[i % colors.length]);
            lineRenderer.setSeriesStroke(i, new BasicStroke(2f));
        }
    }
    //]

    mainPlot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, mainPlot, true);

    formatColorTheme(chart, theme);

    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.
 * //from  w  w w . j  a v  a  2s . c  o m
 * @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 ww.  j a  va  2s .c o  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.nbb.demetra.dfm.output.simulation.RealTimePerspGraphView.java

private JFreeChart createChart() {
    XYPlot plot = new XYPlot();

    plot.setDataset(TRUE_DATA_INDEX, Charts.emptyXYDataset());
    plot.setRenderer(TRUE_DATA_INDEX, trueDataRenderer);
    plot.mapDatasetToDomainAxis(TRUE_DATA_INDEX, 0);
    plot.mapDatasetToRangeAxis(TRUE_DATA_INDEX, 0);

    plot.setDataset(FCTS_INDEX, Charts.emptyXYDataset());
    plot.setRenderer(FCTS_INDEX, forecastsRenderer);
    plot.mapDatasetToDomainAxis(FCTS_INDEX, 0);
    plot.mapDatasetToRangeAxis(FCTS_INDEX, 0);

    plot.setDataset(ARIMA_DATA_INDEX, Charts.emptyXYDataset());
    plot.setRenderer(ARIMA_DATA_INDEX, arimaRenderer);
    plot.mapDatasetToDomainAxis(ARIMA_DATA_INDEX, 0);
    plot.mapDatasetToRangeAxis(ARIMA_DATA_INDEX, 0);

    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

    JFreeChart result = new JFreeChart("", TsCharts.CHART_TITLE_FONT, plot, false);
    result.setPadding(TsCharts.CHART_PADDING);
    return result;
}