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:UserInterface.JFreeChartJPanel.java

public JFreeChartJPanel(VitalSign vs, JPanel upc) {
    initComponents();//from ww  w.ja v a  2  s  .com

    this.vs = vs;
    this.upc = upc;

    int rr = (vs.getRespiratoryrate());
    int hr = vs.getHeartrate();
    int bp = vs.getBloodpressure();
    double w = vs.getWeight();
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(rr, "", "Respiratory Rate");
    dataset.setValue(hr, "", "Heart Rate");
    dataset.setValue(bp, "", "Blood Pressure");
    dataset.setValue(w, "", "Weight");

    //    
    org.jfree.chart.JFreeChart chart = ChartFactory.createBarChart("VitalSign", "Vital Signs", "Range", dataset,
            PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinePaint(Color.black);
    ChartFrame frame = new ChartFrame("Bar Chart for _---_", chart);
    frame.setVisible(true);
    frame.setSize(600, 600);
}

From source file:utils.Graficos_old.java

public static JFreeChart GraficoLinhas(List<CarCapContas> pagar, List<CarCapContas> receber, String titulo) {

    XYSeries series1 = new XYSeries("Pagar");

    //        CarCapContas contasPagar = new CarCapContas();
    for (CarCapContas contasPagar : pagar) {

        series1.add(contasPagar.getContaValorTotal(), contasPagar.getContaDataEmissao().getMonth());

    }//from w w w. jav a2s. c o m

    XYSeries series2 = new XYSeries("Receber");

    for (CarCapContas contasReceber : receber) {

        series2.add(contasReceber.getContaValorTotal(), contasReceber.getContaDataEmissao().getMonth());

    }

    XYSeriesCollection dataset = new XYSeriesCollection();

    dataset.addSeries(series1);
    dataset.addSeries(series2);

    JFreeChart chart = ChartFactory.createXYLineChart(titulo, // chart title
            "X", // x axis label
            "Y", // 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);

    // 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, false);
    renderer.setSeriesShapesVisible(1, false);
    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:edu.wustl.cab2b.client.ui.visualization.charts.ScatterPlot.java

protected JFreeChart createChart(Dataset dataset) {
    XYDataset xyDataset = (XYDataset) dataset;
    JFreeChart jfreechart = ChartFactory.createScatterPlot("Scatter Plot", "X", "Y", xyDataset,
            PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);

    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setBackgroundPaint(Color.white);
    XYDotRenderer xydotrenderer = new XYDotRenderer();
    xydotrenderer.setDotWidth(4);/*from   w  ww  .j  a  va2s .  c  o m*/
    xydotrenderer.setDotHeight(4);

    xyplot.setRenderer(xydotrenderer);
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);

    NumberAxis numberaxis = (NumberAxis) xyplot.getDomainAxis();
    numberaxis.setAutoRangeIncludesZero(false);

    return jfreechart;
}

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

private static JFreeChart createChart(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart("SubCategoryAxis Demo 1", "Category", "Value", dataset,
            PlotOrientation.VERTICAL, false, true, false);
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    SubCategoryAxis subCategoryAxis = new SubCategoryAxis(null);
    subCategoryAxis.addSubCategory("S1");
    subCategoryAxis.addSubCategory("S2");
    subCategoryAxis.addSubCategory("S3");
    plot.setDomainAxis(subCategoryAxis);
    plot.setDomainGridlinePaint(Color.white);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);
    NumberAxis valueAxis = (NumberAxis) plot.getRangeAxis();
    valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);/*from  w  ww .j  a v a  2 s . com*/
    GradientPaint gradientpaint0 = new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, new Color(0, 0, 64));
    GradientPaint gradientpaint1 = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, new Color(0, 64, 0));
    GradientPaint gradientpaint2 = new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, new Color(64, 0, 0));
    renderer.setSeriesPaint(0, gradientpaint0);
    renderer.setSeriesPaint(1, gradientpaint1);
    renderer.setSeriesPaint(2, gradientpaint2);
    return chart;
}

From source file:userinterface.CyberSecurity.ChartFactory.java

public static ChartPanel createChart(UserAccount account) {
    Map<String, LoginDetails> loginDetails = account.getLoginDetails();
    DefaultCategoryDataset dataset1 = new DefaultCategoryDataset();
    DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();

    Collection<LoginDetails> values = loginDetails.values();

    for (LoginDetails details : values) {
        dataset1.addValue(TimeUnit.MILLISECONDS.toHours(details.getLogoutTime() - details.getLoginTime()),
                HOURS_WORKED_BY_USER, details.getLoginDate());
        dataset2.addValue(2.5, MINIMUM_WORKING_HOURS, details.getLoginDate());
    }//from w w  w.j a  v  a2s. co m

    dataset1.addValue(2, HOURS_WORKED_BY_USER, "4-19-2016");
    dataset1.addValue(3, HOURS_WORKED_BY_USER, "4-20-2016");
    dataset2.addValue(2.5, MINIMUM_WORKING_HOURS, "4-19-2016");
    dataset2.addValue(2.5, MINIMUM_WORKING_HOURS, "4-20-2016");

    final CategoryItemRenderer renderer = new BarRenderer();

    final CategoryPlot plot = new CategoryPlot();
    plot.setDataset(dataset1);
    plot.setRenderer(renderer);

    plot.setDomainAxis(new CategoryAxis("Date"));
    plot.setRangeAxis(new NumberAxis("Hours"));

    plot.setOrientation(PlotOrientation.VERTICAL);
    plot.setRangeGridlinesVisible(true);
    plot.setDomainGridlinesVisible(true);

    // now create the second dataset and renderer...
    final CategoryItemRenderer renderer2 = new LineAndShapeRenderer();
    plot.setDataset(1, dataset2);
    plot.setRenderer(1, renderer2);

    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

    plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    final JFreeChart chart = new JFreeChart(plot);
    chart.setTitle("Employee work hours");

    chart.setBackgroundPaint(Color.WHITE);
    // add the chart to a panel...
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    return chartPanel;
}

From source file:statistics.distribution.ConstantDistribution.java

@Override
public JFreeChart getChart() {
    JFreeChart chart = ChartFactory.createXYLineChart("Constant Distribution", "", "", getDataset(),
            PlotOrientation.VERTICAL, true, true, false);
    return chart;
}

From source file:io.github.mzmine.util.jfreechart.ChartNodeJFreeChart.java

public ChartNodeJFreeChart() {

    super(ChartFactory.createXYLineChart("", // title
            "", // x-axis label
            "", // y-axis label
            null, // data set
            PlotOrientation.VERTICAL, // orientation
            true, // create legend?
            true, // generate tooltips?
            false // generate URLs?
    ), false);// www  . j a v a 2s.  com

}

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

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createLineChart("Line Chart Demo 8", "Category", "Count",
            categorydataset, PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setRangeGridlinePaint(Color.white);
    SymbolAxis symbolaxis = new SymbolAxis("Group", new String[] { "A", "B", "C", "D", "E", "F" });
    categoryplot.setRangeAxis(symbolaxis);
    LineAndShapeRenderer lineandshaperenderer = (LineAndShapeRenderer) categoryplot.getRenderer();
    lineandshaperenderer.setSeriesShapesVisible(0, true);
    lineandshaperenderer.setSeriesShapesVisible(1, false);
    lineandshaperenderer.setSeriesShapesVisible(2, true);
    lineandshaperenderer.setSeriesLinesVisible(2, false);
    lineandshaperenderer.setSeriesShape(2, ShapeUtilities.createDiamond(4F));
    lineandshaperenderer.setDrawOutlines(true);
    lineandshaperenderer.setUseFillPaint(true);
    lineandshaperenderer.setBaseFillPaint(Color.white);
    return jfreechart;
}

From source file:overTrial.CreateGraphOverTrial.java

public CreateGraphOverTrial(String applicationTitle, String chartTitle, LinkedList<LinkedList<String>> pData,
        int sensorNum, String sessionNo) {
    super(applicationTitle);
    this.pressureData = pData;
    this.sensorNumber = sensorNum;
    JFreeChart lineChart = ChartFactory.createLineChart(chartTitle, sessionNo,
            "Average Pressure Value over the time(per trail)", createDataset(), PlotOrientation.VERTICAL, true,
            true, false);/*w w  w  .j a va  2  s. c  om*/
    //lineChart.setBackgroundPaint(Color.red);
    ChartPanel chartPanel = new ChartPanel(lineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(1200, 500));
    setContentPane(chartPanel);

    File fileLineChart = new File(sessionNo + "_sensor" + this.sensorNumber + ".jpeg");
    try {
        ChartUtilities.saveChartAsJPEG(fileLineChart, lineChart, 1200, 500);
    } catch (IOException e) {
        e.printStackTrace();
    }

}

From source file:view.tankDepthDetails.BarrChart.java

/**
 * Creates new form BarrChart//from   w ww . ja  va 2s. co m
 */
public BarrChart() {
    initComponents();

    DefaultCategoryDataset dcd = new DefaultCategoryDataset();
    float s = 8;
    dcd.setValue(s, "Marks", "Dumindu");
    dcd.setValue(88.80, "Marks", "lakal");
    dcd.setValue(78.80, "Marks", "Charitha");
    dcd.setValue(7.80, "Marks", "lahiru");
    dcd.setValue(76.80, "Marks", "mahin");
    dcd.setValue(90.80, "Marks", "gin");

    JFreeChart Jchart = ChartFactory.createBarChart("Tank Level Records", "Time", "Tank Level", dcd,
            PlotOrientation.VERTICAL, true, true, false);
    CategoryPlot plot = Jchart.getCategoryPlot();
    plot.setRangeGridlinePaint(java.awt.Color.black);

    ChartFrame chartfra = new ChartFrame("Tank Level Records", Jchart, true);
    //   chartfra.setVisible(true);
    chartfra.setSize(400, 500);

    ChartPanel chartPanel = new ChartPanel(Jchart);

    jPanel2.removeAll();
    jPanel2.add(chartPanel);
    jPanel2.updateUI();

}