List of usage examples for org.jfree.data.xy XYSeriesCollection XYSeriesCollection
public XYSeriesCollection(XYSeries series)
From source file:GUI.Data.java
/** * Creates new form Data/*from w w w .j a v a2 s .c om*/ */ public Data() { XYSeries Goals = new XYSeries("Goals Scored"); Goals.add(1, 1.0); Goals.add(2, 3.0); Goals.add(3, 2.0); Goals.add(4, 0.0); Goals.add(5, 3.0); XYDataset xyDataset = new XYSeriesCollection(Goals); JFreeChart chart = ChartFactory.createXYLineChart("Goals Scored Over Time", "Fixture Number", "Goals", xyDataset, PlotOrientation.VERTICAL, true, true, false); ChartPanel cp = new ChartPanel(chart) { @Override public Dimension getPreferredSize() { return new Dimension(320, 240); } }; cp.setMouseWheelEnabled(true); add(cp); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); initComponents(); }
From source file:org.jfree.chart.demo.LogarithmicAxisDemo1.java
private static XYDataset createDataset() { XYSeries xyseries = new XYSeries("Random Data"); xyseries.add(1.0D, 500.19999999999999D); xyseries.add(5D, 694.10000000000002D); xyseries.add(4D, 100D);/*from w ww . j a v a 2s . c om*/ xyseries.add(12.5D, 734.39999999999998D); xyseries.add(17.300000000000001D, 453.19999999999999D); xyseries.add(21.199999999999999D, 500.19999999999999D); xyseries.add(21.899999999999999D, 9005.5D); xyseries.add(25.600000000000001D, 734.39999999999998D); xyseries.add(3000D, 453.19999999999999D); return new XYSeriesCollection(xyseries); }
From source file:AppPackage.HumidityGraph.java
/** * *///from w w w.j a v a2s.c o m public HumidityGraph() { try { JFrame window = new JFrame(); window.setSize(1000, 615); window.setBackground(Color.blue); Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) ((dimension.getWidth() - window.getWidth()) / 2); int y = (int) ((dimension.getHeight() - window.getHeight()) / 2); window.setLocation(x, y); XYSeries series = new XYSeries("Humidity "); XYSeriesCollection dataset = new XYSeriesCollection(series); JFreeChart chart = ChartFactory.createXYLineChart("Humidity against Time", "Time(seconds)", "Humidity(percentage)", dataset); window.add(new ChartPanel(chart), BorderLayout.CENTER); window.setVisible(true); } catch (Exception e) { System.out.print("Chart exception:" + e); } initComponents(); }
From source file:GUI.PlotHere.java
/** * Creates new form PlotHere// w w w .j a v a 2 s.c om */ public PlotHere(String Title) { initComponents(); XYSeries Input00 = new XYSeries("Input 00"); XYSeries Input01 = new XYSeries("Input 01"); XYSeries Input02 = new XYSeries("Input 02"); XYSeriesCollection data = new XYSeriesCollection(Input00); data.addSeries(Input01); data.addSeries(Input02); JFreeChart chart = ChartFactory.createXYLineChart(Title, "Angle", "Voltage", data, PlotOrientation.VERTICAL, true, true, false); ChartPanel chartpanel = new ChartPanel(chart); //chartpanel.setDomainZoomable(true); chartpanel.setPreferredSize(new java.awt.Dimension(200, 200)); //JPanel jPanel4 = new JPanel(); Component[] a = GraphHerePanel.getComponents(); if (a.length == 0) { GraphHerePanel.setLayout(new BorderLayout()); GraphHerePanel.add(chartpanel); } this.revalidate(); this.repaint(); }
From source file:com.oracle.cch.swingtest.ChartJFrame.java
/** * Creates new form ChartJFrame/*w w w. ja va 2s . c o m*/ */ public ChartJFrame() { initComponents(); XYSeries Goals = new XYSeries("Goals Scored"); Goals.add(1, 1.0); Goals.add(2, 3.0); Goals.add(3, 2.0); Goals.add(4, 0.0); Goals.add(5, 3.0); XYDataset xyDataset = new XYSeriesCollection(Goals); chart = ChartFactory.createXYLineChart("Goals Scored Over Time", "Fixture Number", "Goals", xyDataset, PlotOrientation.VERTICAL, true, true, false); ChartPanel cp = new ChartPanel(chart) { @Override public Dimension getPreferredSize() { return new Dimension(320, 240); } }; FlowLayout fl = new FlowLayout(); this.setLayout(fl); this.add(cp); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); }
From source file:mes2.Chart.java
public void createwykres() { XYSeriesCollection xySeriesCollection = new XYSeriesCollection(dataSet); // Dodanie kolejnych serii do kolekcji: xySeriesCollection.addSeries(dataSet2); // tworzenie XYDataSet XYDataset xyDataset = xySeriesCollection; // tworzenie wykresu JFreeChart lineGraph = ChartFactory.createXYLineChart("Wykres nagrzewania wsadu", // Title "Czas", // X-Axis label "Temperatura", // Y-Axis label xyDataset, // Dataset PlotOrientation.VERTICAL, //Plot orientation true, //show legend true, // Show tooltips false //url show );/* ww w.ja v a2 s. c o m*/ ChartFrame frame1 = new ChartFrame("Szybkie wyswietlanie wykresu - klasa ChartFrame", lineGraph); frame1.pack(); frame1.setVisible(true); frame1.setLocationRelativeTo(null); //frame1.setDefaultCloseOperation(DISPOSE_ON_CLOSE); ChartPanel chartPanel = new ChartPanel(lineGraph); //frame.getContentPane().add(chartPanel); // frame.getContentPane().add(new JLabel("<<< wykres dodany jako ChartPanel")); }
From source file:frequencyassignment.charts.Charts.java
public static void displayScatterPlot(String name, HashMap<Double, Double> values) { XYSeries xyData = new XYSeries(name); for (Map.Entry<Double, Double> entry : values.entrySet()) { xyData.add(entry.getKey(), entry.getValue()); }/*from w ww.j a va 2 s. c o m*/ XYSeriesCollection xySeriesCollection = new XYSeriesCollection(xyData); JFreeChart chart = ChartFactory.createScatterPlot(name, "X", "Y", (XYDataset) xySeriesCollection); ChartFrame frame = new ChartFrame(name, chart); frame.pack(); frame.setVisible(true); }
From source file:cpsControllers.LineChartController.java
/** * Method for create line chart./*from w w w . j av a 2 s.co m*/ * * @param t * @param values * @return */ public JFreeChart printChart(ArrayList<Integer> t, ArrayList<Double> values) { // Prepare the data set XYSeries xySeries = new XYSeries("Number & Square Chart"); double[] val = new double[values.size()]; for (int i = 0; i < val.length; i++) { xySeries.add(i, values.get(i)); } XYDataset xyDataset = new XYSeriesCollection(xySeries); //Create the chart JFreeChart chart = ChartFactory.createXYLineChart("Wykres liniowy", "Czas (t)", "Aplituda (A)", xyDataset, PlotOrientation.VERTICAL, false, true, false); // //Render the frame // ChartFrame chartFrame = new ChartFrame("Wykres sygnalu ", chart); // chartFrame.setVisible(true); // chartFrame.setSize(800, 600); return chart; }
From source file:JchartTest.GetChartAction.java
@Override public String execute() throws Exception { ValueAxis xAxis = new NumberAxis("Input Increase"); ValueAxis yAxis = new NumberAxis("Production"); XYSeries xySeries = new XYSeries(new Integer(1)); xySeries.add(0, 200);/* w w w.j a va 2 s .co m*/ xySeries.add(1, 300); xySeries.add(2, 500); xySeries.add(3, 700); xySeries.add(4, 700); xySeries.add(5, 900); XYSeriesCollection xyDataset = new XYSeriesCollection(xySeries); // create XYPlot XYPlot xyPlot = new XYPlot(xyDataset, xAxis, yAxis, new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES_AND_LINES)); chart = new JFreeChart(xyPlot); return SUCCESS; }
From source file:no.imr.sea2data.guibase.chart.XYBarChart.java
public XYBarChart() { dataset = new XYSeriesCollection(new XYSeries("Series 1")); JFreeChart chart = ChartFactory.createXYBarChart("", "X axis", false, "Y axis", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.white); chart.getTitle().setPaint(Color.black); chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN, 12)); chart.addSubtitle(trendLegend);/*from w w w . ja va 2s . com*/ chart.addSubtitle(trendLegend2); trendLegend.setPosition(RectangleEdge.TOP); trendLegend2.setPosition(RectangleEdge.TOP); plot = (XYPlot) chart.getPlot(); XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer(); renderer.setShadowVisible(false); chartPanel = new ChartPanel(chart); plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits()); }