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.drugis.addis.gui.LyndOBrienChartFactory.java

public static JFreeChart buildScatterPlot(LyndOBrienModel model) {
    XYDataset data = new ScatterPlotDataset(model);
    JFreeChart chart = ChartFactory.createScatterPlot("Benefit-Risk plane", model.getXAxisName(),
            model.getYAxisName(), data, PlotOrientation.VERTICAL, false, false, false);

    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) chart.getXYPlot().getRenderer();
    renderer.setSeriesOutlinePaint(0, Color.black);
    renderer.setUseOutlinePaint(true);/*from  w  ww.  jav a2  s . co  m*/
    renderer.setSeriesShape(0, new Ellipse2D.Double(-2.0, 2.0, 4.0, 4.0));

    // draw lines through origin.
    chart.getXYPlot().setDomainZeroBaselineVisible(true);
    chart.getXYPlot().setRangeZeroBaselineVisible(true);

    // Explicitly set the stroke-width to avoid a rendering error in Linux
    Stroke stroke = new BasicStroke(1.0f);
    chart.getXYPlot().setDomainZeroBaselineStroke(stroke);
    return chart;
}

From source file:Servidor.java

private void inicializarGraficosBarras() {
    datosBarras = new DefaultCategoryDataset();
    chart = ChartFactory.createBarChart("Grfica de barras.", "Candidatos", "Votos Obtenidos", datosBarras,
            PlotOrientation.VERTICAL, true, true, false);
    frame = new ChartFrame("Vista", chart);
    frame.pack();//from w  w w . j  a v a  2 s. c  o m
    frame.setVisible(true);

}

From source file:cs.register.geraGrafico.java

public geraGrafico(String title, int type, List<partida> L) {
    super(title);
    JFreeChart chart = null;/*from  w w  w  .  ja  va  2 s.co  m*/
    switch (type) {
    case 0:
        chart = ChartFactory.createXYLineChart(title, "X", "y", datakill(L), PlotOrientation.VERTICAL, true,
                true, false);
    case 1:
        chart = ChartFactory.createXYLineChart(title, "X", "y", datakda(L), PlotOrientation.VERTICAL, true,
                true, false);
    case 2:
        chart = ChartFactory.createXYLineChart(title, "X", "y", datawld(L), PlotOrientation.VERTICAL, true,
                true, false);
    case 3:
        chart = ChartFactory.createXYLineChart(title, "X", "y", datasocore(L), PlotOrientation.VERTICAL, true,
                true, false);
    case 4:
        chart = ChartFactory.createXYLineChart(title, "X", "y", datarank(L), PlotOrientation.VERTICAL, true,
                true, false);

    }
    graf = new ChartPanel(chart);
    graf.setPreferredSize(new java.awt.Dimension(560, 367));
    XYPlot plot = chart.getXYPlot();
    XYLineAndShapeRenderer rendrer = new XYLineAndShapeRenderer();
    rendrer.setSeriesPaint(0, Color.GREEN);
    rendrer.setSeriesStroke(0, new BasicStroke(4.0f));
    plot.setRenderer(rendrer);
    setContentPane(graf);

}

From source file:nodeconfig.FinalFuzzyChart.java

public FinalFuzzyChart(String applicationTitle, String chartTitle) {
    super(applicationTitle);
    JFreeChart barChart = ChartFactory.createBarChart(chartTitle, "Nodes", "Fuzzy", createDataset(),
            PlotOrientation.VERTICAL, true, true, false);

    ChartPanel chartPanel = new ChartPanel(barChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));
    setContentPane(chartPanel);/*from   www.  j  a  v  a 2  s  .c  o m*/
}

From source file:lifnetwork.ChartSave.java

public ChartSave() {
    super(ChartFactory.createScatterPlot("Population Fire", "Time (s)", "Neuron #", (new XYSeriesCollection()),
            PlotOrientation.VERTICAL, false, false, false));
    fireChart = this.getChart();
    fireChart.setNotify(false);//from   w  ww. jav a  2s.c  o m
    XYPlot plot = fireChart.getXYPlot();
    plot.setBackgroundPaint(Color.WHITE);
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setSeriesShapesVisible(0, true);
    renderer.setSeriesShape(0, new Rectangle2D.Double(0, 0, 1, 1));
    fireCollection = (XYSeriesCollection) plot.getDataset();
    fireSeries = new XYSeries("fires");
    fireCollection.addSeries(fireSeries);
}

From source file:spectrex.Charts.java

/**
 * @param data initial data for chart creation
 * @param title text which would be displayed at the top of the frame and in
 * the frame's title//from   www  . ja  v  a 2s. co  m
 * @param columnLabel text which would be displayed on the left of the
 * Y-axis
 * @param rowLabel text which would be displayed under X-axis
 * @param frameSize size of chart frame
 * @return Bar chart JFrame link
 * @author ReaLgressA
 */
public static JFrame createBarChart(ChartData data, String title, String columnLabel, String rowLabel,
        Dimension frameSize) {
    JFreeChart chart = ChartFactory.createStackedBarChart(title, columnLabel, rowLabel, data.getDataset(),
            PlotOrientation.VERTICAL, true, true, true);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinePaint(Color.BLACK);
    ChartFrame frame = new ChartFrame(title, chart, true);
    frame.setVisible(true);
    frame.setSize(frameSize);
    frame.setResizable(true);
    return (JFrame) frame;
}

From source file:cv.mikusher.freechart.XYLineChart.java

public XYLineChart(String applicationTitle, String chartTitle) {
    super(applicationTitle);
    setDefaultCloseOperation(ApplicationFrame.EXIT_ON_CLOSE);
    JFreeChart xylineChart = ChartFactory.createXYLineChart(chartTitle, "Category", "Score", createDataset(),
            PlotOrientation.VERTICAL, true, true, false);

    ChartPanel chartPanel = new ChartPanel(xylineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));
    final XYPlot plot = xylineChart.getXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesPaint(0, Color.RED);
    renderer.setSeriesPaint(1, Color.GREEN);
    renderer.setSeriesPaint(2, Color.YELLOW);
    renderer.setSeriesStroke(0, new BasicStroke(4.0f));
    renderer.setSeriesStroke(1, new BasicStroke(3.0f));
    renderer.setSeriesStroke(2, new BasicStroke(2.0f));
    plot.setRenderer(renderer);/*w  w w .j  a  va 2  s.  c  o  m*/
    setContentPane(chartPanel);
}

From source file:Logica.Graficas.java

public void tipoGrafica(int tipo) {
    switch (tipo) {
    case LINEAL://w  w w .  ja v  a 2 s . c  om
        grafica = ChartFactory.createXYLineChart(null, tx, ty, datos, PlotOrientation.VERTICAL, true, true,
                true);
        break;
    case AREA:
        grafica = ChartFactory.createXYAreaChart(null, tx, ty, datos, PlotOrientation.VERTICAL, true, true,
                true);
        break;
    }
}

From source file:userInterface.ManufactureRole.DecisionChartJPanel.java

private static JFreeChart createChart1(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart("Vaccine Sales", "Vaccine", "quantity", 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:br.senac.tads.pi3.ghosts.locarsys.dao.Relatorios.java

public static void relatoriosDisponibilidade() throws SQLException, ClassNotFoundException {
    String query = "SELECT FL.NOME_FILIAL, COUNT(FL.NOME_FILIAL) AS QUANTIDADE FROM CARRO CA "
            + "INNER JOIN FILIAL FL ON FL.ID_FILIAL = CA.ID_FILIAL " + "WHERE CA.DISPONIBILIDADE_CARRO = '1' "
            + "GROUP BY FL.NOME_FILIAL";
    Connection conn = Conexoes.obterConexao();
    Statement stmt = conn.createStatement();

    ResultSet rs = stmt.executeQuery(query);

    DefaultCategoryDataset ds = new DefaultCategoryDataset();

    while (rs.next()) {
        ds.addValue(rs.getInt("QUANTIDADE"), "Quantidade", rs.getString("NOME_FILIAL"));
    }//from   w w  w  .  j ava  2 s .  co m

    /*File fg = new File("C:\\Users\\bruno.lopes.KRONMED\\Documents\\NetBeansProjects\\LoCarSys\\src\\main\\webapp\\ImagensLoCarSys\\disponibilidade.png");
     fg.delete();*/
    JFreeChart grafico = ChartFactory.createBarChart3D("Relatrio de Disponibilidade", "Filiais",
            "Separados por filiais", ds, PlotOrientation.VERTICAL, true, true, false);

    //try (OutputStream arquivo = new FileOutputStream("C:\\Users\\bruno.clopes\\Documents\\NetBeansProjects\\LoCarSys\\target\\LoCarSys-1.0-SNAPSHOT\\ImagensLoCarSys\\disponibilidade.png")) {
    try (OutputStream arquivo = new FileOutputStream("ImagensLoCarSys\\disponibilidade.png")) {
        ChartUtilities.writeChartAsPNG(arquivo, grafico, 800, 600);
    } catch (FileNotFoundException ex) {
        System.out.println("" + ex.getMessage());
    } catch (IOException ex) {
        System.out.println("" + ex.getMessage());
    }

    //try (OutputStream arquivo = new FileOutputStream("C:\\Users\\bruno.clopes\\Documents\\NetBeansProjects\\LoCarSys\\target\\LoCarSys-1.0-SNAPSHOT\\ImagensLoCarSys\\disponibilidade.png")) {
    try (OutputStream arquivo = new FileOutputStream(
            "C:\\Users\\temp.cas\\Documents\\NetBeansProjects\\LoCarSys\\target\\LoCarSys-1.0-SNAPSHOT\\ImagensLoCarSys\\disponibilidade.png")) {
        ChartUtilities.writeChartAsPNG(arquivo, grafico, 800, 600);
    } catch (FileNotFoundException ex) {
        System.out.println("" + ex.getMessage());
    } catch (IOException ex) {
        System.out.println("" + ex.getMessage());
    }
}