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:com.mycompany.istudy.principalservices.GraphicalView.java

/**
 * Overwrites the method of createXYLineChart from ChartFactory interface
 * and creates a XYLine Chart.//from   w  ww  .  j  a v a  2 s . com
 * @param applicationTitle
 * @param chartTitle
 * @param investedHoursPerWeek
 * @param hoursToBeInvested 
 */
public GraphicalView(String applicationTitle, String chartTitle, Map<Double, Double> investedHoursPerWeek,
        Map<Double, Double> hoursToBeInvested) {
    super(applicationTitle);
    xylineChart = ChartFactory.createXYLineChart(chartTitle, "Calender Weeks", "Invested Study-hours",
            createDataset(investedHoursPerWeek, hoursToBeInvested), 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.BLUE);
    renderer.setSeriesPaint(1, Color.RED);
    renderer.setSeriesStroke(0, new BasicStroke(4.0f));
    plot.setRenderer(renderer);
    setContentPane(chartPanel);
}

From source file:Data.Graph.java

private JFreeChart makeGraph() {
    return ChartFactory.createBarChart("Political View", "Party", "Tweets", createDataset(),
            PlotOrientation.VERTICAL, false, false, false);
}

From source file:org.samjoey.graphing.GraphUtility.java

/**
 *
 * @param games the games to graph/* www.j a  va  2  s  .  c o  m*/
 * @param key the variable to create the graph with
 * @param start if index, the index at which to start, else the percent in
 * the game at which to start
 * @param stop if index, the index at which to end, else the percent in the
 * game at which to end
 * @param index
 * @return
 */
public static ChartPanel getCustomGraph(Game[] games, String key, double start, double stop, boolean index) {
    XYSeriesCollection dataset = new XYSeriesCollection();
    for (Game game : games) {
        ArrayList<Double> data = game.getVar(key);
        int begin;
        int end;
        if (index) {
            begin = (int) start;
            end = (int) stop;
        } else {
            begin = (int) (data.size() / start);
            end = (int) (data.size() / stop);
        }
        XYSeries series = GraphUtility.createSeries(data.subList(begin, end), "" + game.getId());
        dataset.addSeries(series);
    }
    JFreeChart chart = ChartFactory.createXYLineChart(key, // chart title
            "X", // x axis label
            "Y", // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, false, // include legend
            true, // tooltips
            false // urls
    );
    XYPlot plot = chart.getXYPlot();
    XYItemRenderer rend = plot.getRenderer();
    for (int i = 0; i < games.length; i++) {
        Game g = games[i];
        if (g.getWinner() == 1) {
            rend.setSeriesPaint(i, Color.RED);
        }
        if (g.getWinner() == 2) {
            rend.setSeriesPaint(i, Color.BLACK);
        }
        if (g.getWinner() == 0) {
            rend.setSeriesPaint(i, Color.PINK);
        }
    }
    ChartPanel chartPanel = new ChartPanel(chart);
    return chartPanel;
}

From source file:rework.MainFrame.java

/**
 * Creates new form MainFrame// w w w .j  ava2s  .  c  om
 */
public MainFrame() {
    chart = ChartFactory.createXYLineChart("Graphique", "x", "Value", createDataset(), PlotOrientation.VERTICAL,
            true, true, false);

    initComponents();

    fileChooser = new JFileChooser();
    fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    FileNameExtensionFilter filter = new FileNameExtensionFilter("CSV Files", "csv");
    fileChooser.setFileFilter(filter);

    layerStack1.initComponents(transfList);
    layerStack1.updateLayerStack();

    datalist.addObserver(this);
    transfList.addObserver(layerStack1);

    datalist.add(new Point(new Date(), 1, 5.0));
    datalist.add(new Point(new Date(), 2, 15.0));
    datalist.add(new Point(new Date(), 3, 25.0));
    datalist.add(new Point(new Date(), 4, 20.0));
    datalist.add(new Point(new Date(), 5, 25.0));
    datalist.add(new Point(new Date(), 6, 35.0));
    datalist.add(new Point(new Date(), 7, 5.0));
    datalist.add(new Point(new Date(), 8, 15.0));
    datalist.add(new Point(new Date(), 9, 25.0));
    datalist.add(new Point(new Date(), 10, 20.0));
    datalist.add(new Point(new Date(), 11, 25.0));
    datalist.add(new Point(new Date(), 12, 35.0));
    datalist.add(new Point(new Date(), 13, 5.0));
    datalist.add(new Point(new Date(), 14, 15.0));
    datalist.add(new Point(new Date(), 15, 25.0));
    datalist.add(new Point(new Date(), 16, 20.0));
    datalist.add(new Point(new Date(), 17, 25.0));
    datalist.add(new Point(new Date(), 18, 35.0));

    tabStack.revalidate();

}

From source file:service.chart.FitnessChart.java

/**
 * Utworz wykres funkcji fitness dla najlepszego osobnika w danej iteracji algorytmu genetycznego 
 * na podstawie zestawu danych// www  .ja  v a2s  .co  m
 * 
 * @param categoryDataset Zestaw danych
 * @return Wykres funkcji fitness
 */
private static JFreeChart createChart(CategoryDataset categoryDataset) {

    JFreeChart chart = ChartFactory.createLineChart("Best fitness function value", // title
            "Iteration", // x-axis label
            "Fitness", // y-axis label
            categoryDataset, // data
            PlotOrientation.VERTICAL, true, // create legend?
            true, // generate tooltips?
            false // generate URLs?
    );

    chart.setBackgroundPaint(Color.white);

    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    CategoryItemRenderer r = plot.getRenderer();
    if (r instanceof LineAndShapeRenderer) {
        LineAndShapeRenderer renderer = (LineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(false);
        renderer.setBaseShapesFilled(true);
    }

    return chart;
}

From source file:Graphics.Linechart.java

public void createGraphic(String titulo, int largura, int altura) {
    CategoryDataset data = this.createDataset();
    grafico = ChartFactory.createLineChart(titulo, xtitle, ytitle, data, PlotOrientation.VERTICAL, true, false,
            false);/*from www  .  ja  va 2 s . c o  m*/
    this.altura = altura;
    this.largura = largura;
    ChartPanel ch = new ChartPanel(grafico);
    ch.setSize(largura, altura);
    ch.setBounds(0, 0, largura, altura);
    this.setDefaultCloseOperation(javax.swing.JFrame.DISPOSE_ON_CLOSE);
    this.setContentPane(ch);
}

From source file:peakmlviewer.widgets.IPeakIntensityGraph.java

@SuppressWarnings("deprecation")
public IPeakIntensityGraph(Composite parent, int style) {
    super(parent, style | SWT.EMBEDDED);

    // create the components
    linechart = ChartFactory.createLineChart(null, "", "Intensity", dataset, PlotOrientation.VERTICAL, false, // legend
            false, // tooltips
            false // urls
    );/*from  ww  w.  j a  va2 s . c om*/

    CategoryPlot plot = (CategoryPlot) linechart.getPlot();
    CategoryAxis axis = (CategoryAxis) plot.getDomainAxis();
    axis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();

    renderer.setShapesFilled(true);
    renderer.setShapesVisible(true);

    linechart.setBackgroundPaint(java.awt.Color.WHITE);
    linechart.setBorderVisible(false);
    linechart.setAntiAlias(true);

    plot.setBackgroundPaint(java.awt.Color.WHITE);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinesVisible(true);

    // add the components
    // --------------------------------------------------------------------------------
    // This uses the SWT-trick for embedding AWT-controls in an SWT-Composite.
    try {
        System.setProperty("sun.awt.noerasebackground", "true");
    } catch (NoSuchMethodError error) {
        ;
    }

    // create a new ChartPanel, without the popup-menu (5x false)
    java.awt.Frame frame = org.eclipse.swt.awt.SWT_AWT.new_Frame(this);
    frame.add(new ChartPanel(linechart, false, false, false, false, false));
    // --------------------------------------------------------------------------------
}

From source file:fuel.gui.stats.BarChartPanel.java

public BarChartPanel(DefaultCategoryDataset barDataset, String message, boolean stacked) {
    JFreeChart barChart;//from  w w  w  .  j  av  a2 s.co  m
    if (stacked) {
        barChart = ChartFactory.createStackedBarChart3D("", // chart title
                "", // domain axis label
                "", // range axis label
                barDataset, // data
                PlotOrientation.VERTICAL, true, // include legend
                true, // tooltips?
                true // URLs?
        );
    } else {
        barChart = ChartFactory.createBarChart3D("", // chart title
                "", // domain axis label
                "", // range axis label
                barDataset, // data
                PlotOrientation.VERTICAL, false, // include legend
                true, // tooltips?
                true // URLs?
        );
    }
    CategoryPlot plot = barChart.getCategoryPlot();
    BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    final CategoryAxis domainAxis = plot.getDomainAxis();
    double count = barDataset.getColumnCount();
    double extra = 16 / count;
    domainAxis.setCategoryLabelPositions(
            CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / (2 + extra)));

    ChartPanel barChartPanel = new ChartPanel(barChart);
    barChartPanel.getChartRenderingInfo().setEntityCollection(null);
    barChartPanel.setBorder(BorderFactory.createTitledBorder(message));
    int wider = barDataset.getColumnCount() * 12;
    barChartPanel.setPreferredSize(new java.awt.Dimension(192 + wider, 240));
    barChartPanel.setLayout(new BorderLayout());
    setLayout(new BorderLayout());
    add(barChartPanel);
}

From source file:jasmine.imaging.shapes.RadiusChart.java

public RadiusChart(Vector<Double> values) {

    super();/*  ww w  .  ja  va2s.com*/

    DefaultCategoryDataset series = new DefaultCategoryDataset();

    for (int i = 0; i < values.size(); i++) {
        series.addValue(values.elementAt(i), "row1", String.valueOf(i));
    }

    setTitle("Radius Change");

    chart = new JLabel();
    getContentPane().add(chart);

    setSize(320, 240);
    setVisible(true);

    myChart = ChartFactory.createLineChart(null, null, null, series, PlotOrientation.VERTICAL, false, false,
            false);

    addComponentListener(new ComponentAdapter() {
        public void componentResized(ComponentEvent e) {
            if (myChart != null)
                updateChart();
        }
    });

}

From source file:com.sjsu.uidesign.ExecStatus.java

public ExecStatus() {
    super();/*from w w  w . j a  va2 s . co m*/
    super.setTitle("Task Execution Status");
    super.setSize(500, 500);
    super.setResizable(true);
    super.setLocationRelativeTo(null);

    JLabel usageImage = new JLabel();
    //usageImage.setIcon(new ImageIcon("Pie_3.png"));

    //usageImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/sjsu/uidesign/Bar_4.png"))); // NOI18N
    //add(usageImage);

    DefaultCategoryDataset barChartData = new DefaultCategoryDataset();
    barChartData.setValue(6, "Cache Cleanup", "Cache Cleanup");
    barChartData.setValue(8, "Antivirus Scan", "Antivirus Scan");
    barChartData.setValue(7, "Empty Recycle Bin", "Empty Recycle Bin");

    JFreeChart barChart = ChartFactory.createBarChart("Task Execution Status", "Task Name", "Status",
            createDataset(), PlotOrientation.VERTICAL, true, true, false);
    CategoryPlot barChar = barChart.getCategoryPlot();
    barChar.setRangeGridlinePaint(Color.ORANGE);

    ChartPanel barPanel = new ChartPanel(barChart);

    JPanel panelChart = new JPanel();
    panelChart.removeAll();
    panelChart.add(barPanel, BorderLayout.CENTER);
    panelChart.validate();
    add(panelChart);
}