Example usage for org.jfree.chart ChartFactory createXYLineChart

List of usage examples for org.jfree.chart ChartFactory createXYLineChart

Introduction

In this page you can find the example usage for org.jfree.chart ChartFactory createXYLineChart.

Prototype

public static JFreeChart createXYLineChart(String title, String xAxisLabel, String yAxisLabel,
        XYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) 

Source Link

Document

Creates a line chart (based on an XYDataset ) with default settings.

Usage

From source file:wef.articulab.view.ui.BNXYPlot.java

/**
 * Creates an overlaid chart.// www. j  a va2s .c o  m
 *
 * @return The chart.
 */
private JFreeChart createChart() {
    createDataset();
    final JFreeChart chart = ChartFactory.createXYLineChart("Real Time Network Dynamics", "Time", "Activation",
            dataset, PlotOrientation.VERTICAL, true, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    target = new IntervalMarker(14, 16);
    target.setLabel("Activation Threshold");
    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);
    XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
    BasicStroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
    for (int i = 0; i < series.length - 1; i++) {
        renderer.setSeriesStroke(i, stroke);
    }
    renderer.setSeriesStroke(series.length - 1, new BasicStroke(2.0f, BasicStroke.CAP_BUTT,
            BasicStroke.JOIN_MITER, 10.0f, new float[] { 10.0f }, 0.0f));
    plot.setRenderer(renderer);
    return chart;
}

From source file:org.datacleaner.widgets.result.NumberAnalyzerResultSwingRenderer.java

@Override
protected void decorate(NumberAnalyzerResult result, DCTable table,
        final DisplayChartCallback displayChartCallback) {
    // find the std. deviation row number.
    int rowNumber = -1;
    {//from   w  w  w . j av a  2  s  .c  o m
        for (int i = 0; i < table.getRowCount(); i++) {
            Object value = table.getValueAt(i, 0);
            if (NumberAnalyzer.MEASURE_STANDARD_DEVIATION.equals(value)) {
                rowNumber = i;
                break;
            }
        }
        if (rowNumber == -1) {
            throw new IllegalStateException("Could not determine Std. deviation row number!");
        }
    }

    Crosstab<?> crosstab = result.getCrosstab();

    final InputColumn<? extends Number>[] columns = result.getColumns();
    int columnNumber = 1;
    for (final InputColumn<? extends Number> column : columns) {
        final CrosstabNavigator<?> nav = crosstab.where(NumberAnalyzer.DIMENSION_COLUMN, column.getName());

        final Number numRows = (Number) nav
                .where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_ROW_COUNT).get();
        if (numRows.intValue() > 0) {
            final Number standardDeviation = (Number) nav
                    .where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_STANDARD_DEVIATION).get();
            if (standardDeviation != null) {

                ActionListener action = new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        final Number mean = (Number) nav
                                .where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_MEAN).get();
                        final Number min = (Number) nav
                                .where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_LOWEST_VALUE)
                                .get();
                        final Number max = (Number) nav
                                .where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_HIGHEST_VALUE)
                                .get();

                        final NormalDistributionFunction2D normalDistributionFunction = new NormalDistributionFunction2D(
                                mean.doubleValue(), standardDeviation.doubleValue());
                        final XYDataset dataset = DatasetUtilities.sampleFunction2D(normalDistributionFunction,
                                min.doubleValue(), max.doubleValue(), 100, "Normal");

                        final JFreeChart chart = ChartFactory.createXYLineChart(
                                "Normal distribution of " + column.getName(), column.getName(), "", dataset,
                                PlotOrientation.VERTICAL, false, true, false);
                        ChartUtils.applyStyles(chart);
                        Marker meanMarker = new ValueMarker(mean.doubleValue(), WidgetUtils.BG_COLOR_BLUE_DARK,
                                new BasicStroke(2f));
                        meanMarker.setLabel("Mean");
                        meanMarker.setLabelOffset(new RectangleInsets(70d, 25d, 0d, 0d));
                        meanMarker.setLabelFont(WidgetUtils.FONT_SMALL);
                        chart.getXYPlot().addDomainMarker(meanMarker);

                        final ChartPanel chartPanel = ChartUtils.createPanel(chart, true);
                        displayChartCallback.displayChart(chartPanel);
                    }
                };

                DCPanel panel = AbstractCrosstabResultSwingRenderer.createActionableValuePanel(
                        standardDeviation, Alignment.RIGHT, action, IconUtils.CHART_LINE);
                table.setValueAt(panel, rowNumber, columnNumber);
            }
        }

        columnNumber++;
    }

    super.decorate(result, table, displayChartCallback);
}

From source file:mil.tatrc.physiology.utilities.csv.plots.CSVPlotTool.java

public void createGraph(String toDir, Paint color, String title, String XAxisLabel, String YAxisLabel,
        XYSeries... xyData) {//  w  w w . ja v a2 s . c om
    new File(toDir).mkdir();

    Log.info("Creating Graph " + toDir + "/" + title);
    double resMin0 = 1.e6;
    double resMax0 = -1.e6;
    double resMin1 = 1.e6;
    double resMax1 = -1.e6;

    XYSeriesCollection dataSet = new XYSeriesCollection();
    for (XYSeries data : xyData) {
        if (data != null && !data.isEmpty())
            dataSet.addSeries(data);
    }

    JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title
            XAxisLabel, // x axis label
            YAxisLabel, // y axis label
            dataSet, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
    );

    XYPlot plot = (XYPlot) chart.getPlot();
    /* I have residual and error plots turned off, there are some plots that contain these names in their title, and I don't want this code running, need a better way to see if we are doing a special plot rather than title contents
        if(title.contains("Residual"))
        {
          // Make plot symmetric about x axis
          resMax0 = xyData[0].getMaxY();
          resMin0 = xyData[0].getMinY();
          if (Math.abs(xyData[0].getMinY()) > Math.abs(xyData[0].getMaxY()))  resMax0 = Math.abs(resMin0);
          if (Math.abs(xyData[0].getMaxY()) > Math.abs(xyData[0].getMinY()))  resMin0 = -1.0*Math.abs(resMax0);
          if((resMin0==0.0) && (resMax0==0.0))
          {
            resMin0 = -0.00001;
            resMax0 =  0.00001;
          }       
          ValueAxis yAxis = plot.getRangeAxis();
          yAxis.setRange(resMin0 + 0.05*resMin0, resMax0 + 0.05*resMax0);//5% buffer so we can see top and bottom clearly
        }
        else if(title.contains("Error"))
        {
          // Make plot symmetric about x axis
          resMax0 = xyData[0].getMaxY();
          resMin0 = xyData[0].getMinY();
          if((resMin0==0.0) && (resMax0==0.0))
          {
            resMin0 = -0.00001;
            resMax0 =  0.00001;
          }
          if(resMin0>=0.0) resMin0 = -0.01;
          ValueAxis yAxis = plot.getRangeAxis();
          yAxis.setRange(resMin0 + 0.05*resMin0, resMax0 + 0.05*resMax0);//5% buffer so we can see top and bottom clearly
            
          /*
           yAxis.setTickLabelPaint(new Color(1,0,0));
           yAxis.setTickMarkPaint(new Color(1,0,0));
           yAxis.setAxisLinePaint(new Color(1,0,0));
           yAxis.setLabelPaint(new Color(1,0,0));
            
           ValueAxis xAxis = plot.getDomainAxis();
           xAxis.setTickLabelPaint(new Color(1,0,0));
           xAxis.setTickMarkPaint(new Color(1,0,0));
           yAxis.setAxisLinePaint(new Color(1,0,0));
           yAxis.setLabelPaint(new Color(1,0,0));
           *
        }
        else
    */
    {
        if (title.indexOf("Hemoglobin-GlomerularFilterability") > -1)
            System.out.println("stop");
        if (xyData.length > 1) {
            // Make plot symmetric about x axis
            resMax0 = xyData[0].getMaxY();
            resMin0 = xyData[0].getMinY();
            resMax1 = xyData[1].getMaxY();
            resMin1 = xyData[1].getMinY();
            if (resMin1 < resMin0)
                resMin0 = resMin1;
            if (resMax1 > resMax0)
                resMax0 = resMax1;
            if (DoubleUtils.isZero(resMin0))
                resMin0 = -0.001;
            if (DoubleUtils.isZero(resMax0))
                resMax0 = 0.001;
            if (resMin0 >= 0.0)
                resMin0 = -0.01;
            if (YAxisLabel.indexOf("PlasmaConcentration") > -1)
                plot.setRangeAxis(new LogarithmicAxis("Log(" + YAxisLabel + ")"));
            else {
                ValueAxis yAxis = plot.getRangeAxis();
                yAxis.setRange(resMin0 + 0.05 * resMin0, resMax0 + 0.15 * Math.abs(resMax0));//5% buffer so we can see top and bottom clearly
            }
            String NaNCheck = "";
            if (Double.isNaN(resMax0) || Double.isNaN(resMin0))
                NaNCheck += "Expected is NaN ";
            if (Double.isNaN(resMax1) || Double.isNaN(resMin1))
                NaNCheck += "Computed is NaN ";
            if (!NaNCheck.isEmpty())
                plot.getDomainAxis().setLabel(NaNCheck);
        } else {
            // Make plot symmetric about x axis
            resMax0 = xyData[0].getMaxY();
            resMin0 = xyData[0].getMinY();
            if (Double.isNaN(resMax0) || Double.isNaN(resMin0))
                plot.getDomainAxis().setLabel("Computed is NaN");
            if (DoubleUtils.isZero(resMin0))
                resMin0 = -0.001;
            if (DoubleUtils.isZero(resMax0))
                resMax0 = 0.001;
            if (resMin0 >= 0.0)
                resMin0 = -0.01;
            if (YAxisLabel.indexOf("PlasmaConcentration") > -1)
                plot.setRangeAxis(new LogarithmicAxis("Log(" + YAxisLabel + ")"));
            else {
                ValueAxis yAxis = plot.getRangeAxis();
                yAxis.setRange(resMin0 + 0.05 * resMin0, resMax0 + 0.15 * Math.abs(resMax0));//5% buffer so we can see top and bottom clearly
            }
        }
    }

    formatXYPlot(chart, color);
    //Changing line widths and colors
    XYItemRenderer r = plot.getRenderer();
    BasicStroke wideLine = new BasicStroke(lineWidth);
    r.setSeriesStroke(0, wideLine);
    r.setSeriesStroke(1, wideLine);
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    if (xyData.length > 1) {
        renderer.setSeriesStroke(//makes a dashed line
                0, //argument below float[]{I,K} -> alternates between solid and opaque (solid for I, opaque for K)
                new BasicStroke(lineWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f,
                        new float[] { 15.0f, 30.0f }, 0.0f));
        renderer.setDrawSeriesLineAsPath(true);
        renderer.setUseFillPaint(true);
    }
    renderer.setBaseShapesVisible(false);
    renderer.setSeriesFillPaint(0, expectedLineColor);
    renderer.setSeriesFillPaint(1, computedLineColor);
    renderer.setSeriesPaint(0, expectedLineColor);
    renderer.setSeriesPaint(1, computedLineColor);

    try {
        if (toDir == null || toDir.isEmpty())
            toDir = ".";
        File JPGFile = new File(toDir + "/" + MakeFileName(title) + ".jpg");
        ChartUtilities.saveChartAsJPEG(JPGFile, chart, 1600, 800);
    } catch (IOException e) {
        Log.error(e.getMessage());
    }
}

From source file:scrum.server.common.BurndownChart.java

private static JFreeChart createSprintBurndownChart(List<BurndownSnapshot> snapshots, Date firstDay,
        Date lastDay, Date originallyLastDay, WeekdaySelector freeDays, int dateMarkTickUnit,
        float widthPerDay) {
    DefaultXYDataset data = createSprintBurndownChartDataset(snapshots, firstDay, lastDay, originallyLastDay,
            freeDays);//from   w w  w.j  a va2s  .c  o  m

    double tick = 1.0;
    double max = BurndownChart.getMaximum(data);

    while (max / tick > 25) {
        tick *= 2;
        if (max / tick <= 25)
            break;
        tick *= 2.5;
        if (max / tick <= 25)
            break;
        tick *= 2;
    }
    double valueLabelTickUnit = tick;
    double upperBoundary = Math.min(max * 1.1f, max + 3);

    if (!Sys.isHeadless())
        LOG.warn("GraphicsEnvironment is not headless");
    JFreeChart chart = ChartFactory.createXYLineChart("", "", "", data, PlotOrientation.VERTICAL, false, true,
            false);

    chart.setBackgroundPaint(Color.WHITE);

    XYPlot plot = chart.getXYPlot();
    // plot.setInsets(new RectangleInsets(0, 0, 0, 0));
    plot.setAxisOffset(RectangleInsets.ZERO_INSETS);
    // plot.setOutlineVisible(false);

    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.lightGray);
    // plot.setRangeCrosshairPaint(Color.lightGray);
    // plot.setRangeMinorGridlinePaint(Color.lightGray);
    // plot.setDomainCrosshairPaint(Color.blue);
    // plot.setDomainMinorGridlinePaint(Color.green);
    // plot.setDomainTickBandPaint(Color.green);

    XYItemRenderer renderer = plot.getRenderer();
    renderer.setBaseStroke(new BasicStroke(2f));

    renderer.setSeriesPaint(0, COLOR_PAST_LINE);
    renderer.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer.setSeriesPaint(1, COLOR_PROJECTION_LINE);
    renderer.setSeriesStroke(1,
            new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL, 1.0f, new float[] { 3f }, 0));
    renderer.setSeriesPaint(2, COLOR_OPTIMUM_LINE);
    renderer.setSeriesStroke(2, new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));

    DateAxis domainAxis1 = new DateAxis();
    String dateFormat = "d.";
    widthPerDay -= 5;
    if (widthPerDay > 40) {
        dateFormat = "EE " + dateFormat;
    }
    if (widthPerDay > 10) {
        float spaces = widthPerDay / 2.7f;
        dateFormat = Str.multiply(" ", (int) spaces) + dateFormat;
    }
    domainAxis1.setDateFormatOverride(new SimpleDateFormat(dateFormat, Locale.US));
    domainAxis1.setTickUnit(new DateTickUnit(DateTickUnit.DAY, dateMarkTickUnit));
    domainAxis1.setAxisLineVisible(false);
    Range range = new Range(firstDay.toMillis(), lastDay.nextDay().toMillis());
    domainAxis1.setRange(range);

    DateAxis domainAxis2 = new DateAxis();
    domainAxis2.setTickUnit(new DateTickUnit(DateTickUnit.DAY, 1));
    domainAxis2.setTickMarksVisible(false);
    domainAxis2.setTickLabelsVisible(false);
    domainAxis2.setRange(range);

    plot.setDomainAxis(0, domainAxis2);
    plot.setDomainAxis(1, domainAxis1);
    plot.setDomainAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);

    NumberAxis rangeAxis = new NumberAxis();
    rangeAxis.setNumberFormatOverride(NumberFormat.getIntegerInstance());
    rangeAxis.setTickUnit(new NumberTickUnit(valueLabelTickUnit));

    rangeAxis.setLowerBound(0);
    rangeAxis.setUpperBound(upperBoundary);

    plot.setRangeAxis(rangeAxis);

    return chart;
}

From source file:pharoslabut.logger.CompassLoggerGUI.java

/**
 * Creates a chart.//  www .  j  av  a  2s.c  o  m
 * 
 * @param dataset  the data for the chart.
 * 
 * @return a chart.
 */
private JFreeChart createChart(final XYDataset dataset) {

    // create the chart...
    final JFreeChart chart = ChartFactory.createXYLineChart("Proteus Robot Compass Measurements", // chart title
            "Time (s)", // x axis label
            "Angle (radians)", // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, false, // include legend
            true, // tooltips
            false // urls
    );

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

    //        final StandardLegend legend = (StandardLegend) chart.getLegend();
    //      legend.setDisplaySeriesShapes(true);

    // get a reference to the plot for further customization...
    final XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.lightGray);
    //    plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesLinesVisible(0, false);
    renderer.setSeriesShapesVisible(1, false);
    plot.setRenderer(renderer);

    final NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setRange(new Range(0, 140));

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    // change the auto tick unit selection to integer units only...
    //        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setRange(new Range(-Math.PI, Math.PI));
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:msi.gama.outputs.layers.charts.ChartJFreeChartOutputScatter.java

@Override
public void createChart(final IScope scope) {
    super.createChart(scope);

    jfreedataset.add(0, new XYIntervalSeriesCollection());
    PlotOrientation orientation = PlotOrientation.VERTICAL;
    if (reverse_axes)
        orientation = PlotOrientation.HORIZONTAL;

    switch (type) {
    case SERIES_CHART: {
        chart = ChartFactory.createXYLineChart(getName(), "", "",
                (XYIntervalSeriesCollection) jfreedataset.get(0), orientation, true, false, false);
        break;//www.ja  v  a  2  s.  c  o m
    }

    case XY_CHART:
        chart = ChartFactory.createXYLineChart(getName(), "", "",
                (XYIntervalSeriesCollection) jfreedataset.get(0), orientation, true, false, false);
        break;
    case SCATTER_CHART:
        chart = ChartFactory.createXYLineChart(getName(), "", "",
                (XYIntervalSeriesCollection) jfreedataset.get(0), orientation, true, false, false);
        break;
    case BOX_WHISKER_CHART: {
        chart = ChartFactory.createBoxAndWhiskerChart(getName(), "Time", "Value",
                (BoxAndWhiskerCategoryDataset) jfreedataset.get(0), true);
        chart.setBackgroundPaint(new Color(249, 231, 236));

        break;
    }

    }

}

From source file:api3.window.sound.panel.SoundPanel.java

public void plot(PanelData data, JFreeChart chart, JPanel plotPanel) {
    chart = ChartFactory.createXYLineChart(data.name, "prbka", "warto", data.dataset,
            PlotOrientation.VERTICAL, true, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    LOG.info("PLOTTING      1");
    domainAxis = (NumberAxis) plot.getDomainAxis();
    plot.addRangeMarker(new ValueMarker(0, Color.BLACK, new BasicStroke(1)));

    ChartPanel chartPanel = new ChartPanel(chart);
    Border border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4),
            BorderFactory.createEtchedBorder());
    chartPanel.setBorder(border);//from  ww w .  j a v a2  s  .c o  m
    LOG.info("PLOTTING      2");
    plotPanel.removeAll();
    plotPanel.add(chartPanel);
    plotPanel.revalidate();
    LOG.info("PLOTTING      3");
}

From source file:org.eobjects.datacleaner.widgets.result.NumberAnalyzerResultSwingRenderer.java

@Override
protected void decorate(NumberAnalyzerResult result, DCTable table,
        final DisplayChartCallback displayChartCallback) {
    // find the std. deviation row number.
    int rowNumber = -1;
    {//from  w  w w .j ava  2s  .c o  m
        for (int i = 0; i < table.getRowCount(); i++) {
            Object value = table.getValueAt(i, 0);
            if (NumberAnalyzer.MEASURE_STANDARD_DEVIATION.equals(value)) {
                rowNumber = i;
                break;
            }
        }
        if (rowNumber == -1) {
            throw new IllegalStateException("Could not determine Std. deviation row number!");
        }
    }

    Crosstab<?> crosstab = result.getCrosstab();

    final InputColumn<? extends Number>[] columns = result.getColumns();
    int columnNumber = 1;
    for (final InputColumn<? extends Number> column : columns) {
        final CrosstabNavigator<?> nav = crosstab.where(NumberAnalyzer.DIMENSION_COLUMN, column.getName());

        final Number numRows = (Number) nav
                .where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_ROW_COUNT).get();
        if (numRows.intValue() > 0) {
            final Number standardDeviation = (Number) nav
                    .where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_STANDARD_DEVIATION).get();
            if (standardDeviation != null) {

                ActionListener action = new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        final Number mean = (Number) nav
                                .where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_MEAN).get();
                        final Number min = (Number) nav
                                .where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_LOWEST_VALUE)
                                .get();
                        final Number max = (Number) nav
                                .where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_HIGHEST_VALUE)
                                .get();

                        final NormalDistributionFunction2D normalDistributionFunction = new NormalDistributionFunction2D(
                                mean.doubleValue(), standardDeviation.doubleValue());
                        final XYDataset dataset = DatasetUtilities.sampleFunction2D(normalDistributionFunction,
                                min.doubleValue(), max.doubleValue(), 100, "Normal");

                        final JFreeChart chart = ChartFactory.createXYLineChart(
                                "Normal distribution of " + column.getName(), column.getName(), "", dataset,
                                PlotOrientation.VERTICAL, false, true, false);
                        ChartUtils.applyStyles(chart);
                        Marker meanMarker = new ValueMarker(mean.doubleValue(), WidgetUtils.BG_COLOR_BLUE_DARK,
                                new BasicStroke(2f));
                        meanMarker.setLabel("Mean");
                        meanMarker.setLabelOffset(new RectangleInsets(70d, 25d, 0d, 0d));
                        meanMarker.setLabelFont(WidgetUtils.FONT_SMALL);
                        chart.getXYPlot().addDomainMarker(meanMarker);

                        final ChartPanel chartPanel = new ChartPanel(chart);
                        displayChartCallback.displayChart(chartPanel);
                    }
                };

                DCPanel panel = AbstractCrosstabResultSwingRenderer.createActionableValuePanel(
                        standardDeviation, Alignment.RIGHT, action, "images/chart-types/line.png");
                table.setValueAt(panel, rowNumber, columnNumber);
            }
        }

        columnNumber++;
    }

    super.decorate(result, table, displayChartCallback);
}

From source file:com.wsntools.iris.tools.Graph.java

public void switchGraphType(int type) {

    if (type != charttype) {

        switch (type) {
        case 0://  w w w  .jav  a2  s. c  o m
            setupChartType(ChartFactory.createXYLineChart(null, null, null, null, PlotOrientation.VERTICAL,
                    true, true, false));
            break;
        case 1:
            setupChartType(ChartFactory.createXYBarChart(null, null, false, null, null,
                    PlotOrientation.VERTICAL, true, true, false));
            break;
        }

        charttype = type;
    }

}

From source file:eu.stratosphere.addons.visualization.swt.SWTGateToolTip.java

private ChartComposite createChart(GateVisualizationData visualizationData, Color backgroundColor) {

    final String yAxisLabel = this.managementGate.isInputGate() ? "No data available/sec."
            : "Capacity limit reached/sec.";

    final JFreeChart chart = ChartFactory.createXYLineChart(null, "Time [sec.]", yAxisLabel,
            visualizationData.getChartCollection(), PlotOrientation.VERTICAL, false, false, false);

    chart.setBackgroundPaint(new java.awt.Color(backgroundColor.getRed(), backgroundColor.getGreen(),
            backgroundColor.getBlue()));

    // Set axis properly
    final XYPlot xyPlot = chart.getXYPlot();
    xyPlot.getDomainAxis().setAutoRange(true);
    xyPlot.getDomainAxis().setAutoRangeMinimumSize(60);

    xyPlot.getRangeAxis().setAutoRange(true);
    // xyPlot.getRangeAxis().setRange(0, 100);

    return new ChartComposite(getShell(), SWT.NONE, chart, true);
}