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:sentimentBarometer.view.Chart.java

/**
 * Creates the chart based on the @see#_dataset
 * @return ChartPanel that extends JPanel so it can be added directly into a JPanel in a Swing Interface
 */// w ww  .j a  v a 2 s.c  o m
public ChartPanel createChart() {
    //create chart
    JFreeChart chart = ChartFactory.createXYLineChart("Rating", "Emotional Words", "Rating", _dataset,
            PlotOrientation.VERTICAL, true, true, false);
    //add chart to panel
    ChartPanel cp = new ChartPanel(chart);
    //return the panel
    return cp;
}

From source file:edu.wustl.cab2b.client.ui.visualization.charts.LineChart.java

protected JFreeChart createChart(Dataset dataset) {
    XYDataset xyDataset = (XYDataset) dataset;
    JFreeChart jfreechart = ChartFactory.createXYLineChart("Line Chart", "X", "Y", xyDataset,
            PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();

    xyplot.setBackgroundPaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);

    XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    xylineandshaperenderer.setShapesVisible(true);
    xylineandshaperenderer.setShapesFilled(true);

    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    return jfreechart;
}

From source file:Interfaz.XYLineChart.java

/** Constructor de clase 
* @param d Dimension/*from w w w. ja va  2s  .c o  m*/
*/
public XYLineChart(Dimension d, ArrayList<Restriccion> rest, ArrayList<Coordenada> cor) {

    //se declara el grafico XY Lineal
    XYDataset xydataset = xyDataset(rest, cor);
    JFreeChart jfreechart = ChartFactory.createXYLineChart("Graficas lineales", "X", "Y", xydataset,
            PlotOrientation.VERTICAL, true, true, false);

    //personalizacin del grafico
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setBackgroundPaint(Color.white);
    xyplot.setDomainGridlinePaint(Color.BLACK);
    xyplot.setRangeGridlinePaint(Color.BLACK);

    // -> Pinta Shapes en los puntos dados por el XYDataset
    //        XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    //        xylineandshaperenderer.setBaseShapesVisible(true);
    //        //--> muestra los valores de cada punto XY
    //        XYItemLabelGenerator xy = new StandardXYItemLabelGenerator();
    //        xylineandshaperenderer.setBaseItemLabelGenerator( xy );
    //        xylineandshaperenderer.setBaseItemLabelsVisible(true);
    //        xylineandshaperenderer.setBaseLinesVisible(true);
    //        xylineandshaperenderer.setBaseItemLabelsVisible(true);                
    //fin de personalizacin

    //se crea la imagen y se asigna a la clase ImageIcon
    BufferedImage bufferedImage = jfreechart.createBufferedImage(d.width, d.height);
    this.setImage(bufferedImage);
}

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

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createLineChart("Line Chart Demo 7", "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);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    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:overTrialSensorSubDivided.CreateGraphSubDivided.java

public CreateGraphSubDivided(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);//from  w  ww.ja  v  a2s  .c  o m
    //lineChart.setBackgroundPaint(Color.red);
    ChartPanel chartPanel = new ChartPanel(lineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(700, 500));
    setContentPane(chartPanel);

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

}

From source file:com.java.reports.ProvisionalChart.java

@Override
public ReportGenerator generateReport() {
    if (!isReportGenerated) {
        if (processProvisionalReport()) {
            chart = ChartFactory.createBarChart3D("Provisional Chart", "EMI Installments", "INR",
                    _datasetProvisional, PlotOrientation.VERTICAL, true, true, false);
            isReportGenerated = true;/*from www.j ava2 s  .com*/
        } else {
            System.out.println("Report Generation Failed - EMI list is empty..");
        }
    }
    return this;
}

From source file:figs.Chart.java

public Chart() {
    super(null, true);
    dataset = new XYSeriesCollection();
    chart = ChartFactory.createXYLineChart("", null, null, dataset, PlotOrientation.VERTICAL, true, true,
            false);// www. j  a v a  2  s.c  o m

    chart.setBackgroundPaint(Color.white);
    setChart(chart);
}

From source file:UserInterface.JFreeChart.java

public JFreeChart(VitalSign vs, JPanel upc) {
    initComponents();/* w  w w. j  av  a  2  s.c  o m*/
    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(450, 350);
}

From source file:overTrialFluctuations.CreateGraphTrialFluctuations.java

public CreateGraphTrialFluctuations(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);/*from  w  ww.  j  a  va 2  s  .  co  m*/
    //lineChart.setBackgroundPaint(Color.red);
    ChartPanel chartPanel = new ChartPanel(lineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(700, 500));
    setContentPane(chartPanel);

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

}

From source file:bbank.CurrentStockWindow.java

/**
 * Creates new form CurrentStockWindow/*from   w w  w.  j  a v  a  2 s  .c om*/
 */
public CurrentStockWindow() {
    initComponents();
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    BloodStock.CalculateTotalBlood();
    dataset.addValue(BloodStock.total_A_accepted, "", "Total Accepted A");
    dataset.addValue(BloodStock.total_A_rejected, "", "Total Rejected A");
    dataset.addValue(BloodStock.total_B_accepted, "", "Total Accepted B");
    dataset.addValue(BloodStock.total_B_rejected, "", "Total Rejected B");
    dataset.addValue(BloodStock.total_O_accepted, "", "Total Accepted O");
    dataset.addValue(BloodStock.total_O_rejected, "", "Total Rejected O");

    JFreeChart chart = ChartFactory.createBarChart("Current Total Blood Stock", "Blood type", "Amount (litres)",
            dataset, PlotOrientation.VERTICAL, false, false, false);
    CategoryPlot catPlot = chart.getCategoryPlot();
    catPlot.setRangeGridlinePaint(Color.BLACK);

    ChartPanel chartpanel = new ChartPanel(chart);
    jPanel1.removeAll();
    jPanel1.add(chartpanel);
    jPanel1.validate();
}