Example usage for org.jfree.chart.plot PlotOrientation VERTICAL

List of usage examples for org.jfree.chart.plot PlotOrientation VERTICAL

Introduction

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

Prototype

PlotOrientation VERTICAL

To view the source code for org.jfree.chart.plot PlotOrientation VERTICAL.

Click Source Link

Document

For a plot where the range axis is vertical.

Usage

From source file:umontreal.iro.lecuyer.charts.XYLineChart.java

protected void init(String title, String XLabel, String YLabel) {
    // create the chart...
    chart = ChartFactory.createXYLineChart(title, // chart title
            XLabel, // x axis label
            YLabel, // y axis label
            dataset.getSeriesCollection(), // data
            PlotOrientation.VERTICAL, false, // include legend
            true, // tooltips
            false // urls
    );/*from www. j  av a  2 s . c  o  m*/

    if (null != title) {
        if (title.startsWith("cdf") || title.startsWith("prob") || title.startsWith("density"))
            setprobFlag(true);
    }

    ((XYPlot) chart.getPlot()).setRenderer(dataset.getRenderer());
    // Initialize axis variables
    initAxis();
}

From source file:script.imglib.analysis.BarChart.java

static private final JFreeChart createChart(final Collection<? extends Number> data, final String title,
        final String xLabel, final String yLabel) {
    DefaultCategoryDataset dcd = new DefaultCategoryDataset();
    int k = 1;/*  w  ww .  j  a  v  a  2 s.co  m*/
    for (final Number value : data) {
        dcd.addValue(value, "", k++);
    }
    boolean legend = false;
    boolean tooltips = true;
    boolean urls = false;
    JFreeChart chart = ChartFactory.createBarChart(title, xLabel, yLabel, dcd, PlotOrientation.VERTICAL, legend,
            tooltips, urls);
    setBarTheme(chart);
    return chart;
}

From source file:com.compomics.pepshell.view.statistics.RatioComparisonPane.java

@Override
public void setGraphData(PepshellProtein aPepshellProtein) {
    if (aPepshellProtein != null && referenceExperiment.getProteins().contains(aPepshellProtein)
            && experimentToCompareTo.getProteins().contains(aPepshellProtein)) {
        CategoryDataset dataset = createRatioDataset(aPepshellProtein);
        JFreeChart ratioChart = ChartFactory.createBarChart("log ratios of peptides on a protein",
                aPepshellProtein.getVisibleAccession(), "log^2 ratio", dataset, PlotOrientation.VERTICAL, true,
                true, false);/*from  www .  j a v  a  2  s.c  o m*/
        prettifyChart(ratioChart);
        chart.setChart(ratioChart);
    }

}

From source file:org.ow2.clif.jenkins.chart.QuantileDistributionChart.java

@Override
protected JFreeChart createChart() {
    JFreeChart chart = ChartFactory.createBarChart(getBasicTitle(),
            Messages.QuantileDistributionChart_PercentageOfRequests(),
            Messages.QuantileDistributionChart_ResponseTime(), data, PlotOrientation.VERTICAL, true, true,
            false);/*from w  w  w .j  ava 2  s  .  c o  m*/
    chart.getCategoryPlot().setRangeGridlinesVisible(true);
    chart.getCategoryPlot().setDomainGridlinesVisible(true);
    return chart;
}

From source file:org.jfree.chart.swt.demo.SWTMultipleAxisDemo1.java

/**
 * Creates the demo chart.//from  ww  w . j  av a2s. c  om
 *
 * @return The chart.
 */
private static JFreeChart createChart() {

    XYDataset dataset1 = createDataset("Series 1", 100.0, new Minute(), 200);

    JFreeChart chart = ChartFactory.createTimeSeriesChart("Multiple Axis Demo 3", "Time of Day",
            "Primary Range Axis", dataset1, true, true, false);

    chart.setBackgroundPaint(Color.white);
    chart.setBorderVisible(true);
    chart.setBorderPaint(Color.BLACK);
    TextTitle subtitle = new TextTitle("Four datasets and four range axes.");
    chart.addSubtitle(subtitle);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setOrientation(PlotOrientation.VERTICAL);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.black);

    // AXIS 2
    NumberAxis axis2 = new NumberAxis("Range Axis 2");
    axis2.setAutoRangeIncludesZero(false);
    axis2.setLabelPaint(Color.red);
    axis2.setTickLabelPaint(Color.red);
    plot.setRangeAxis(1, axis2);
    plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_LEFT);

    XYDataset dataset2 = createDataset("Series 2", 1000.0, new Minute(), 170);
    plot.setDataset(1, dataset2);
    plot.mapDatasetToRangeAxis(1, 1);
    XYItemRenderer renderer2 = new StandardXYItemRenderer();
    renderer2.setSeriesPaint(0, Color.red);
    plot.setRenderer(1, renderer2);

    // AXIS 3
    NumberAxis axis3 = new NumberAxis("Range Axis 3");
    axis3.setLabelPaint(Color.blue);
    axis3.setTickLabelPaint(Color.blue);
    //axis3.setPositiveArrowVisible(true);
    plot.setRangeAxis(2, axis3);

    XYDataset dataset3 = createDataset("Series 3", 10000.0, new Minute(), 170);
    plot.setDataset(2, dataset3);
    plot.mapDatasetToRangeAxis(2, 2);
    XYItemRenderer renderer3 = new StandardXYItemRenderer();
    renderer3.setSeriesPaint(0, Color.blue);
    plot.setRenderer(2, renderer3);

    // AXIS 4
    NumberAxis axis4 = new NumberAxis("Range Axis 4");
    axis4.setLabelPaint(Color.green);
    axis4.setTickLabelPaint(Color.green);
    plot.setRangeAxis(3, axis4);

    XYDataset dataset4 = createDataset("Series 4", 25.0, new Minute(), 200);
    plot.setDataset(3, dataset4);
    plot.mapDatasetToRangeAxis(3, 3);

    XYItemRenderer renderer4 = new StandardXYItemRenderer();
    renderer4.setSeriesPaint(0, Color.green);
    plot.setRenderer(3, renderer4);

    return chart;
}

From source file:eu.udig.tools.jgrass.profile.ProfileView.java

public void createPartControl(Composite parent) {
    series = new XYSeries("profile");
    XYSeriesCollection lineDataset = new XYSeriesCollection();
    lineDataset.addSeries(series);//from ww w .  j a v a  2  s  .  c o  m
    JFreeChart result = ChartFactory.createXYAreaChart("", "Progressive distance", "Elevation", lineDataset,
            PlotOrientation.VERTICAL, true, true, false);
    plot = (XYPlot) result.getPlot();
    ValueAxis axis = plot.getDomainAxis();
    axis.setAutoRange(true);
    renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.black);

    new ChartComposite(parent, SWT.None, result);

    Action action = new ExportChartData();
    IActionBars actionBars = getViewSite().getActionBars();
    IMenuManager dropDownMenu = actionBars.getMenuManager();
    dropDownMenu.add(action);
}

From source file:de.uniol.ui.tsv.ui.StepChartDialog.java

protected JFreeChart createChart() {
    JFreeChart chart = ChartFactory.createXYStepChartFast(title, xTitle, yTitle, xy, PlotOrientation.VERTICAL,
            true, false, false);// www  . ja  v  a  2  s  . co m

    chart.setBackgroundPaint(Color.white);
    chart.getLegend().setBackgroundPaint(new Color(224, 224, 224));

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(new Color(224, 224, 224));
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setRenderer(new XYStepRendererFast(null, null));

    XYItemRenderer xyr = plot.getRenderer();
    //      xyr.setBaseToolTipGenerator(new XYToolTipGenerator() {
    //         public String generateToolTip(XYDataset dataset, int series,
    //               int item) {
    //            return nf.format(dataset.getXValue(series, item))
    //                  + tooltipRangeUnits + ", "
    //                  + nf2.format(dataset.getYValue(series, item))
    //                  + tooltipValueUnits;
    //         }
    //      });

    for (int i : seriesStrokes.keySet()) {
        xyr.setSeriesStroke(i, seriesStrokes.get(i));
    }
    for (int i : seriesColors.keySet()) {
        xyr.setSeriesPaint(i, seriesColors.get(i));
    }

    DateAxis da = new DateAxis(xTitle);
    if (useRelativeHourFormat) {
        da.setDateFormatOverride(new RelativeHourFormat());
    }
    da.setLowerMargin(0.03);
    plot.setDomainAxis(da);

    ValueAxis yaxis = plot.getRangeAxis();
    yaxis.setRange(new Range(minRange, maxRange));

    return chart;
}

From source file:cn.edu.thss.iise.bpmdemo.charts.SWTMultipleAxisDemo1.java

/**
 * Creates the demo chart./*  w ww . ja  v a  2s .c o  m*/
 *
 * @return The chart.
 */
private static JFreeChart createChart() {

    XYDataset dataset1 = createDataset("Series 1", 100.0, new Day(), 200);

    JFreeChart chart = ChartFactory.createTimeSeriesChart("Multiple Axis Demo 3", "Time of Day",
            "Primary Range Axis", dataset1, true, true, false);

    chart.setBackgroundPaint(Color.white);
    chart.setBorderVisible(true);
    chart.setBorderPaint(Color.BLACK);
    TextTitle subtitle = new TextTitle("Four datasets and four range axes.");
    chart.addSubtitle(subtitle);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setOrientation(PlotOrientation.VERTICAL);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.black);

    // AXIS 2
    NumberAxis axis2 = new NumberAxis("Range Axis 2");
    axis2.setAutoRangeIncludesZero(false);
    axis2.setLabelPaint(Color.red);
    axis2.setTickLabelPaint(Color.red);
    plot.setRangeAxis(1, axis2);
    plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_LEFT);

    XYDataset dataset2 = createDataset("Series 2", 1000.0, new Day(), 170);
    plot.setDataset(1, dataset2);
    plot.mapDatasetToRangeAxis(1, 1);
    XYItemRenderer renderer2 = new StandardXYItemRenderer();
    renderer2.setSeriesPaint(0, Color.red);
    plot.setRenderer(1, renderer2);

    // AXIS 3
    NumberAxis axis3 = new NumberAxis("Range Axis 3");
    axis3.setLabelPaint(Color.blue);
    axis3.setTickLabelPaint(Color.blue);
    // axis3.setPositiveArrowVisible(true);
    plot.setRangeAxis(2, axis3);

    XYDataset dataset3 = createDataset("Series 3", 10000.0, new Day(), 170);
    plot.setDataset(2, dataset3);
    plot.mapDatasetToRangeAxis(2, 2);
    XYItemRenderer renderer3 = new StandardXYItemRenderer();
    renderer3.setSeriesPaint(0, Color.blue);
    plot.setRenderer(2, renderer3);

    // AXIS 4
    NumberAxis axis4 = new NumberAxis("Range Axis 4");
    axis4.setLabelPaint(Color.green);
    axis4.setTickLabelPaint(Color.green);
    plot.setRangeAxis(3, axis4);

    XYDataset dataset4 = createDataset("Series 4", 25.0, new Day(), 200);
    plot.setDataset(3, dataset4);
    plot.mapDatasetToRangeAxis(3, 3);

    XYItemRenderer renderer4 = new StandardXYItemRenderer();
    renderer4.setSeriesPaint(0, Color.green);
    plot.setRenderer(3, renderer4);

    return chart;
}

From source file:bc.ui.swing.charts.LineChart.java

public void setModel(LineVisualModel line) {
    XYDataset dataset = createDataset(line);
    JFreeChart chart = ChartFactory.createXYLineChart(line.getTitle(), // chart title
            line.getDomainAxisLabel(), // x axis label
            line.getRangeAxisLabel(), // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );/*from w  w w  .  j a v  a 2s  .co  m*/

    chart.setBackgroundPaint(Color.white);

    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);

    renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    renderer.setSeriesPaint(0, new Color(153, 215, 255));

    removeAll();
    chartPanel = new ChartPanel(chart);
    add(chartPanel, BorderLayout.CENTER);
}