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:org.jfree.chart.demo.AxisOffsetsDemo1.java

private static JFreeChart createChart(String s, CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart(s, "Category", "Value", categorydataset,
            PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setDomainGridlinesVisible(true);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();
    barrenderer.setDrawBarOutline(false);
    GradientPaint gradientpaint = 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));
    barrenderer.setSeriesPaint(0, gradientpaint);
    barrenderer.setSeriesPaint(1, gradientpaint1);
    barrenderer.setSeriesPaint(2, gradientpaint2);
    return jfreechart;
}

From source file:RutherfordScattering.GraphViewPanel.java

public JFreeChart getResultChart() {
    this.chart = ChartFactory.createXYLineChart("Distance between", "Time", "Distance", data,
            PlotOrientation.VERTICAL, true, true, false);
    return this.chart;
}

From source file:gui.MainForm.java

private static JFreeChart create_AMS_DATA_Chart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart("AMS??", "", "??", categorydataset,
            PlotOrientation.VERTICAL, true, true, false);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setDomainGridlinesVisible(true);
    categoryplot.setRangeCrosshairVisible(true);
    categoryplot.setRangeCrosshairPaint(Color.blue);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();
    barrenderer.setDrawBarOutline(false);
    GradientPaint gradientpaint = 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));
    barrenderer.setSeriesPaint(0, gradientpaint);
    barrenderer.setSeriesPaint(1, gradientpaint1);
    barrenderer.setSeriesPaint(2, gradientpaint2);
    barrenderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}"));
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setCategoryLabelPositions(
            CategoryLabelPositions.createUpRotationLabelPositions(0.52359877559829882D));
    return jfreechart;
}

From source file:userinterface.patientRole.LineChart.java

public LineChart(String applicationTitle, String chartTitle, XYSeries bR, XYSeries pR, XYSeries bS, XYSeries bP,
        JFrame parent) {/*from w w w .  j  a  va2 s.  c o  m*/
    // super(applicationTitle);
    this.bR = bR;
    this.pR = pR;
    this.bS = bS;
    this.bP = bP;
    this.parent = parent;
    dataset = createDataset();
    JFreeChart xylineChart = ChartFactory.createXYLineChart(chartTitle, "Category", "Vital Signs",
            createDataset(), PlotOrientation.VERTICAL, true, true, false);
    ChartPanel chartPanel = new ChartPanel(xylineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));
    final XYPlot plot = xylineChart.getXYPlot();
    plot.setBackgroundPaint(Color.white);
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesPaint(0, Color.RED);
    renderer.setSeriesPaint(1, Color.GREEN);
    renderer.setSeriesPaint(2, Color.YELLOW);
    renderer.setSeriesPaint(3, Color.BLUE);
    renderer.setSeriesStroke(0, new BasicStroke(1.0f));
    renderer.setSeriesStroke(1, new BasicStroke(1.0f));
    renderer.setSeriesStroke(2, new BasicStroke(1.0f));
    renderer.setSeriesStroke(3, new BasicStroke(1.0f));
    plot.setRenderer(renderer);
    setContentPane(chartPanel);
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }
    });
}

From source file:jamel.gui.charts.Histogram.java

/**
 * Returns a new plot./*from  w  w w .  ja v  a2 s .  c o m*/
 * @param dataset  the dataset.
 * @param hAxisLabel  the label for the x axis.
 * @param vAxisLabel  the label for the y axis.
 * @param color  the color of the chart.
 * @return the new plot.
 */
static private Plot newPlot(HistogramDataset dataset, String hAxisLabel, String vAxisLabel, Color color) {
    NumberAxis xAxis = new NumberAxis(hAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    ValueAxis yAxis = new NumberAxis(vAxisLabel);
    XYBarRenderer renderer = new XYBarRenderer();
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setShadowVisible(false);
    renderer.setMargin(0.05);
    renderer.setSeriesPaint(0, color);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(PlotOrientation.VERTICAL);
    plot.setDomainZeroBaselineVisible(true);
    plot.setRangeZeroBaselineVisible(true);
    return plot;
}

From source file:jmbench.plots.MemoryRelativeBarPlot.java

public MemoryRelativeBarPlot(String title) {
    chart = ChartFactory.createBarChart(title, // chart title
            "Operation", // domain axis label
            "Relative Memory", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );/*from ww w  .  j  a v  a 2s .  c o m*/
    chart.addSubtitle(new TextTitle("(Smaller is Better)", new Font("SansSerif", Font.ITALIC, 12)));

    plot();
}

From source file:graficos.GenerarGraficoInventario.java

public void crear() {
    try {/*from w ww .j a  va2  s.com*/
        Dba db = new Dba(pathdb);
        db.conectar();
        String sql = "select Nombre, CantidadDisponibles, CantidadEnUso from Activos";
        db.prepare(sql);
        db.query.execute();
        ResultSet rs = db.query.getResultSet();
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        while (rs.next()) {
            int total = rs.getInt(2) + rs.getInt(3);
            dataset.setValue(total, "Cantidad", rs.getString(1));
        }

        JFreeChart chart = ChartFactory.createBarChart3D("Inventario de Activos del Hotel", "Activo",
                "Cantidad", dataset, PlotOrientation.VERTICAL, false, true, false);
        CategoryPlot p = chart.getCategoryPlot(); // Get the Plot object for a bar graph
        p.setBackgroundPaint(Color.black);
        ((BarRenderer) p.getRenderer()).setBarPainter(new StandardBarPainter());

        BarRenderer r = (BarRenderer) chart.getCategoryPlot().getRenderer();
        r.setSeriesPaint(0, Color.BLUE);

        try {
            ChartUtilities.saveChartAsJPEG(new File(path), chart, 500, 300);
        } catch (Exception ee) {
            System.err.println(ee.toString());
            System.err.println("Problem occurred creating chart.");
        }

        db.desconectar();
    } catch (Exception e) {

    }

}

From source file:scatterplot1k.JFreeScatter2.java

private JFreeChart createChart(String title, XYDataset dataset) {
    JFreeChart jfreechart = ChartFactory.createScatterPlot(title, "X", "Y", createDataset(),
            PlotOrientation.VERTICAL, true, true, false);
    //XYItemRenderer renderer = xyPlot.getRenderer();
    //renderer.setSeriesPaint(0, Color.blue);
    //NumberAxis domain = (NumberAxis) xyPlot.getDomainAxis();
    //domain.setVerticalTickLabels(true);
    return jfreechart;
}

From source file:app.Histogram.java

public void createHistogram(List<WordStatistic> was) {
    final String series1 = "??? ";
    final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    was.sort(null);/*from  w  w w.  j  a  v  a  2s  .c om*/
    for (int i = 0; i < 40; i++) {
        dataset.addValue(was.get(i).getFrequency(), series1, was.get(i).getWord());
    }
    final JFreeChart chart = ChartFactory.createBarChart(
            "? ?? ? ?? ??   ?",
            "??? ",
            "? ?? ?? ", dataset,
            PlotOrientation.VERTICAL, false, true, false);
    histogramDesign(chart);
}

From source file:iad_2_gg.gui.ChartDialog.java

public ChartDialog(java.awt.Frame parent, boolean modal, String chartTitle, String xLabel, String yLabel,
        List<Double> values1, String sName1, List<Double> values2, String sName2, int interval) {
    super(parent, modal);

    JFreeChart lineChart = ChartFactory.createXYLineChart(chartTitle, xLabel, yLabel,
            createDataset(values1, sName1, values2, sName2, interval), PlotOrientation.VERTICAL, true, true,
            false);// w  ww . ja va2 s  .c  o  m

    ChartPanel chartPanel = new ChartPanel(lineChart);
    chartPanel.setPreferredSize(new Dimension(1200, 600));
    setContentPane(chartPanel);
    initComponents();
}