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:richclient.EvolutionChart.java

/**
 * Creates a chart./*  w w  w  .j ava  2 s .c  om*/
 *
 * @param dataset the data for the chart.
 *
 * @return a chart.
 */
public JFreeChart createChart(XYDataset dataset) {

    // create the chart
    final JFreeChart chart = ChartFactory.createXYLineChart("Market evolution", // chart title
            "Time", // x axis label
            "Value", // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // 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 customisation...
    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, true);
    renderer.setSeriesShapesVisible(1, true);
    plot.setRenderer(renderer);

    // change the auto tick unit selection to integer units only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:ch.zhaw.ias.dito.ui.util.HistogramFrame.java

public HistogramFrame(Question q) {
    String title = Translation.INSTANCE.get("misc.graphic.histogram") + " " + q.getName();
    setTitle(title);//from  w  ww . ja v  a2 s  . com
    HistogramDataset hist = new HistogramDataset();
    hist.setType(HistogramType.FREQUENCY);

    Set<Double> values = new TreeSet<Double>();
    q.getData().addValuesToCollection(values);
    int numOfBins = Math.min(values.size(), (q.getData().filteredLength() / 20) + 10);
    hist.addSeries(q.getName(), q.getData().getValues(), numOfBins);

    JFreeChart chart = ChartFactory.createHistogram(title, Translation.INSTANCE.get("misc.graphic.value"),
            Translation.INSTANCE.get("misc.graphic.frequency"), hist, PlotOrientation.VERTICAL, false, true,
            false);
    this.add(new ChartPanel(chart), BorderLayout.CENTER);

    this.setSize(300, 300);
    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    this.setVisible(true);
}

From source file:tusys.view.jPanelChart.java

/**
 * Creates new form jPanelChart//from  www .  j a va  2 s . co  m
 */

public jPanelChart(String chartTitle) {
    initComponents();
    JFreeChart barChart = ChartFactory.createBarChart(chartTitle, "Category", "Score", createDataset(),
            PlotOrientation.VERTICAL, true, true, false);

    ChartPanel chartPanel = new ChartPanel(barChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));
    add(chartPanel);
}

From source file:com.ouc.cpss.view.EmpSaleChartBuilder.java

private static JFreeChart createJFreeChart(CategoryDataset dataset) {
    /**//w  ww  .ja v  a 2  s  .  c  o  m
     * JFreeChart
     */
    //?     
    StandardChartTheme standardChartTheme = new StandardChartTheme("CN");
    //     
    standardChartTheme.setExtraLargeFont(new Font("", Font.BOLD, 20));
    //    
    standardChartTheme.setRegularFont(new Font("", Font.PLAIN, 15));
    //?     
    standardChartTheme.setLargeFont(new Font("", Font.PLAIN, 15));
    //?   
    ChartFactory.setChartTheme(standardChartTheme);
    //?
    JFreeChart jfreeChart = ChartFactory.createBarChart3D("", "", "?", dataset,
            PlotOrientation.VERTICAL, true, false, false);
    /**
     * JFreeChart
     */
    jfreeChart.setTitle(new TextTitle("", new Font("", Font.BOLD + Font.ITALIC, 20)));
    CategoryPlot plot = (CategoryPlot) jfreeChart.getPlot();
    CategoryAxis categoryAxis = plot.getDomainAxis();
    categoryAxis.setLabelFont(new Font("", Font.ROMAN_BASELINE, 12));

    return jfreeChart;
}

From source file:org.jfree.chart.demo.Graphic.java

public Graphic(String title) {

    this.title = title;

    mas_x.add((double) 0);
    mas_y.add((double) 0);

    dataset = new XYSeriesCollection();
    chart = ChartFactory.createXYLineChart(title, "T -  ", "U - ", dataset,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot plot = chart.getXYPlot();// w  ww  . j  a v  a 2s.  c o  m

    plot.setDomainCrosshairLockedOnData(true);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    plot.setRangeCrosshairLockedOnData(true);

}

From source file:pwm.visualizer.MotivationDistributionPanel.java

private JPanel createPanel(String title) {
    IntervalXYDataset xybardataset = new XYBarDataset(motivationDataSet, 0.2D);
    JFreeChart jfreechart = ChartFactory.createXYBarChart(title, "", false, "Likelihood", xybardataset,
            PlotOrientation.VERTICAL, true, false, false);
    xyplot = (XYPlot) jfreechart.getPlot();
    NumberAxis numberaxis = (NumberAxis) xyplot.getDomainAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer();
    xybarrenderer.setDrawBarOutline(false);

    return new ChartPanel(jfreechart);
}

From source file:org.jfree.chart.demo.DeviationRendererDemo3.java

private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart chart = ChartFactory.createXYLineChart("DeviationRenderer - Demo 3", "X", "Y", xydataset,
            PlotOrientation.VERTICAL, false, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    ///*w w w  .j a v  a2s  .  co m*/
    DeviationRenderer renderer = new DeviationRenderer(false, false);
    renderer.setSeriesStroke(0, new BasicStroke(3F, 1, 1));
    renderer.setSeriesStroke(0, new BasicStroke(3F, 1, 1));
    renderer.setSeriesStroke(1, new BasicStroke(3F, 1, 1));
    renderer.setSeriesFillPaint(0, Color.red);
    renderer.setSeriesFillPaint(1, Color.orange);
    renderer.setSeriesFillPaint(2, Color.green);
    plot.setRenderer(renderer);
    //
    DateAxis domainAxis = new DateAxis("Date");
    domainAxis.setLowerMargin(0.0D);
    domainAxis.setUpperMargin(0.0D);
    plot.setDomainAxis(domainAxis);
    NumberAxis valueAxis = (NumberAxis) plot.getRangeAxis();
    valueAxis.setRange(-40D, 40D);
    valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    ChartUtilities.applyCurrentTheme(chart);
    return chart;
}

From source file:sim.app.sugarscape.Charts.java

JFreeChart createTradeChart() {
    JFreeChart chart = ChartFactory.createXYLineChart("Trading and Population over Time", "Time", "Level",
            model.agents_series_coll, PlotOrientation.VERTICAL, true, true, false);
    model.trade_chart = chart;/*ww  w.j  av  a  2s  .  c om*/
    NumberAxis rangeAxis1 = new NumberAxis("Time");
    rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    org.jfree.chart.axis.NumberAxis domainAxis = new NumberAxis("Bins");
    XYPlot plot = chart.getXYPlot();
    ValueAxis xAxis = plot.getDomainAxis();
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.BLUE);
    plot.setDataset(1, model.trade_coll);
    XYItemRenderer rend2 = new StandardXYItemRenderer();
    //if (rend2 != null)
    rend2.setSeriesPaint(1, Color.BLACK);
    plot.setRenderer(1, rend2);
    return chart;
}

From source file:org.jw.service.factory.StatisticsChartFactory.java

public static JFreeChart createBarChart(CategoryDataset dataset, String title, String categoryAxisLabel,
        String valueAxisLabel) {/*from  w  w w.  jav a2s .  c om*/
    JFreeChart chart = ChartFactory.createBarChart(title, categoryAxisLabel, valueAxisLabel, dataset,
            PlotOrientation.VERTICAL, true, true, true);
    return chart;
}

From source file:de.fub.maps.project.plugins.tasks.eval.RoadClassifcationDiagram.java

/**
 * Creates new form RoadClassifcationDiagram
 *//*from w  w  w. jav a2s  .  com*/
public RoadClassifcationDiagram() {
    initComponents();
    barChart = ChartFactory.createXYBarChart(null, "Degree", false, null, dataset, PlotOrientation.VERTICAL,
            true, true, true);
    barChart.setBackgroundPaint(Color.WHITE);
    barChart.getPlot().setBackgroundPaint(Color.WHITE);
    chartpanel = new ChartPanel(barChart, false);
    add(chartpanel, BorderLayout.CENTER);
}