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:simphy.XYChart.java

public XYChart(Pendulum p) {
    this.p = p;//from w w w  .  j a va  2  s .  c o m
    type = "pendulum";
    // Create a simple XY chart
    series = new XYSeries("Omega-Time Plot");
    series1 = new XYSeries("Theta-Time Plot");
    dataset = new XYSeriesCollection();
    dataset.addSeries(series);
    dataset.addSeries(series1);
    // Generate the graph
    chart = ChartFactory.createXYLineChart("Velocity/Angle Graph", // Title
            "time", // x-axis Label
            "Angular Velocity(rad/s)/Angle(rad)", // y-axis Label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // Plot Orientation
            true, // Show Legend
            true, // Use tooltips
            false // Configure chart to generate URLs?
    );
    this.setTitle(p.toString());
    this.setBounds(950, 0, 400, 700);
    panel = new ChartPanel(chart, false);
    this.add(panel, BorderLayout.CENTER);
    this.setAlwaysOnTop(true);
    this.addWindowListener(this);
    this.pack();

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            XYChart.this.setVisible(true);
        }
    });

}

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

public static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createStackedAreaChart("Stacked Area Chart", "Category", "Value",
            categorydataset, PlotOrientation.VERTICAL, true, true, false);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setForegroundAlpha(0.85F);
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setLowerMargin(0.0D);//from  w w w.  j  av  a 2 s  . c o  m
    categoryaxis.setUpperMargin(0.0D);
    categoryaxis.setCategoryMargin(0.0D);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    CategoryItemRenderer categoryitemrenderer = categoryplot.getRenderer();
    categoryitemrenderer.setBaseItemLabelsVisible(true);
    return jfreechart;
}

From source file:UI.Graphic.java

private void init() {
    panel = new JPanel();
    getContentPane().add(panel);/*www.j  av  a 2 s .c  o m*/
    // Fuente de Datos
    DefaultCategoryDataset line_chart_dataset = new DefaultCategoryDataset();
    for (int i = 0; i < experiment1.getMedia().size(); i++) {
        line_chart_dataset.addValue(experiment1.getMedia().get(i), "aptitud", String.valueOf(i));
    }

    // Creando el Grafico
    JFreeChart chart = ChartFactory.createLineChart("Apitud de las generaciones", "Generacion", "Aptitud",
            line_chart_dataset, PlotOrientation.VERTICAL, true, true, false);

    // Mostrar Grafico
    ChartPanel chartPanel = new ChartPanel(chart);
    panel.add(chartPanel);
}

From source file:com.thalesgroup.hudson.plugins.sourcemonitor.SourceMonitorChartBuilder.java

public static JFreeChart buildChart(SourceMonitorBuildAction action) {
    JFreeChart chart = ChartFactory.createStackedAreaChart(null, null, "Number of errors", buildDataset(action),
            PlotOrientation.VERTICAL, true, false, true);

    chart.setBackgroundPaint(Color.white);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);//  ww w.  j a  v a  2  s .  c om
    plot.setForegroundAlpha(0.8f);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.black);

    CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
    plot.setDomainAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.setCategoryMargin(0.0);
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    // crop extra space around the graph
    plot.setInsets(new RectangleInsets(0, 0, 0, 5.0));

    CategoryItemRenderer firstRender = new DefaultCategoryItemRenderer();
    SourceMonitorRenderer renderer = new SourceMonitorRenderer(action.getUrlName());
    plot.setRenderer(firstRender);

    return chart;
}

From source file:GUI.GraficaView.java

private void init() {
    ArrayList<OperacionesDiarias> aux = operario.getArrayOperacionesDiarias();
    Collections.sort(aux);//w w  w.j a v a 2  s . c o m

    panel = new JPanel();
    getContentPane().add(panel);
    // Fuente de Datos
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (OperacionesDiarias op : aux) {
        if (op.getListaOperaciones().size() > 0) {
            dataset.setValue(op.getPorcentaje(), operario.getNombre(), op.getFecha());
        }

    }

    // Creando el Grafico
    JFreeChart chart = ChartFactory.createBarChart3D("Rendimiento", "Dia", "Porcentaje %", dataset,
            PlotOrientation.VERTICAL, true, true, false);
    chart.setBackgroundPaint(Color.LIGHT_GRAY);
    chart.getTitle().setPaint(Color.black);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.red);

    // Mostrar Grafico
    ChartPanel chartPanel = new ChartPanel(chart);
    panel.add(chartPanel);
    repaint();
}

From source file:pl.poid.bzdp.zadanieObrazy.ImageHistogram.java

private JFreeChart createChart(final XYSeriesCollection dataset, Color c) {

    final JFreeChart chart = ChartFactory.createXYBarChart("Histogram", "Brightness", false, "Values", dataset,
            PlotOrientation.VERTICAL, true, true, false);

    XYItemRenderer renderer = chart.getXYPlot().getRenderer();
    renderer.setSeriesPaint(0, c);/*from   w  w w .ja v a  2s.co m*/
    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    return chart;

}

From source file:com.awesheet.models.charts.BarChart.java

@Override
public boolean generateImageData() {
    // Create the dataset.
    DefaultCategoryDataset dataset = createDataset();

    if (dataset == null) {
        return false;
    }/*  ww  w .  j  a  v  a 2  s  .  co m*/

    // Create the chart.
    JFreeChart barChart = ChartFactory.createBarChart(title, nameX, nameY, dataset, PlotOrientation.VERTICAL,
            true, true, false);

    final CategoryPlot plot = barChart.getCategoryPlot();
    ((BarRenderer) plot.getRenderer()).setBarPainter(new StandardBarPainter());

    // Generate the image.
    try {
        imageData = ChartUtilities.encodeAsPNG(barChart.createBufferedImage(720, 480));
    } catch (IOException e) {
        return false;
    }

    return true;
}

From source file:Utils.GeneradorDeGraficas.java

public JFreeChart graficarInventario(DeterministaGeneral general, String unidad) {
    XYDataset dataset;//  www.j av  a2s .  c  o  m
    if (general.getTipo() == "escasez")
        dataset = createDatasetEscasez(general);
    else
        dataset = createDataset(general);

    return ChartFactory.createXYLineChart("Perfil del Inventario", "Tiempo en " + unidad, "Unidades", dataset,
            PlotOrientation.VERTICAL, true, true, false);
}

From source file:com.awesheet.models.charts.LineChart.java

@Override
public boolean generateImageData() {
    // Create the dataset.
    DefaultCategoryDataset dataset = createDataset();

    if (dataset == null) {
        return false;
    }//from w ww  .j a v  a2s .c  o  m

    // Create the chart.
    JFreeChart lineChart = ChartFactory.createLineChart(title, nameX, nameY, dataset, PlotOrientation.VERTICAL,
            true, true, false);

    //final CategoryPlot plot = lineChart.getCategoryPlot();
    //((BarRenderer) plot.getRenderer()).setBarPainter(new StandardBarPainter());

    // Generate the image.
    try {
        imageData = ChartUtilities.encodeAsPNG(lineChart.createBufferedImage(720, 480));
    } catch (IOException e) {
        return false;
    }

    return true;
}

From source file:com.jeco.ui.view.GraficoPeso.java

public void drawGrafico(Ovino ovino) {
    if (ovino == null) {
        ovino = new Ovino();
        ovino.setCodigo("00");
    }/* w w w .  j a  v  a2  s . co  m*/
    DefaultCategoryDataset ds = new DefaultCategoryDataset();

    for (Pesagem pesagem : ovino.getHistoricoPesos()) {
        ds.addValue(pesagem.getPeso(), "Peso", pesagem.getData());
    }

    //cria o grafico..
    JFreeChart data = ChartFactory.createBarChart("", "Data", "Peso do Ovino " + ovino.getCodigo(), ds,
            PlotOrientation.VERTICAL, true, true, false);

    ChartPanel chartPanel = new ChartPanel(data);
    this.chartPanel = chartPanel;
    chartPanel.setPreferredSize(new java.awt.Dimension(378, 260));
    this.setBackground(new java.awt.Color(255, 255, 255));
    this.remove(chartPanel);
    this.repaint();
    this.add(chartPanel);
    chartPanel.setBackground(new java.awt.Color(255, 255, 255));
    this.repaint();
}