List of usage examples for org.jfree.chart ChartFactory createXYLineChart
public static JFreeChart createXYLineChart(String title, String xAxisLabel, String yAxisLabel, XYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
From source file:com.jml.main.Graph.java
public void drawLineChart(String title, XYDataset xYDataset) { JFreeChart chart = ChartFactory.createXYLineChart(title, null, null, xYDataset, PlotOrientation.VERTICAL, true, true, false);/*from w w w . j a v a 2 s . c o m*/ panel = new ChartPanel(chart); this.add(panel); this.pack(); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setVisible(true); }
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);//www . ja v a 2 s.co m ChartPanel chartPanel = new ChartPanel(lineChart); chartPanel.setPreferredSize(new Dimension(1200, 600)); setContentPane(chartPanel); initComponents(); }
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 v a2 s .co 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:cgpanalyser.gui.chart.ChartCreator.java
private JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createXYLineChart(null, "Generation", "Fitness", dataset, PlotOrientation.VERTICAL, false, true, false); if (dataset != null) { XYPlot plot = (XYPlot) chart.getPlot(); setCrosshairProperties(plot, true); setCrosshairDefaultValue(plot, dataset); setBothAxisProperties(plot, dataset); setShapes(plot);/*from w w w . j a v a 2s .c o m*/ //setRenderer(plot, dataset); } return chart; }
From source file:com.raghav.plot.XYSeriesDemo.java
/** * A demonstration application showing an XY series containing a null value. * * @param title the frame title./*from ww w . j a va2 s . c om*/ */ public XYSeriesDemo(final String title) { super(title); final XYSeries series = new XYSeries("Random Data"); // float x=1; // float y=(float)((Math.sqrt(2))*x); // for (int i = 1; i < 200000; i++) { double x = (((double) (i)) / 1000); System.out.print("x = " + x); double xdb = 10 * (Math.log10(x)); System.out.print("\t 10logx=" + xdb); double y = Erf.erfc(Math.sqrt(x)); System.out.print("\t y=" + y); System.out.println("----------------------"); series.add(xdb, y); } final XYSeriesCollection data = new XYSeriesCollection(series); final JFreeChart chart = ChartFactory.createXYLineChart("XY Series Demo", "X", "Y", data, PlotOrientation.VERTICAL, true, true, false); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); }
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:org.apache.qpid.disttest.charting.chartbuilder.XYLineChartBuilder.java
@Override public JFreeChart createChartImpl(String title, String xAxisTitle, String yAxisTitle, final Dataset dataset, PlotOrientation plotOrientation, boolean showLegend, boolean showToolTips, boolean showUrls) { JFreeChart chart = ChartFactory.createXYLineChart(title, xAxisTitle, yAxisTitle, (XYDataset) dataset, plotOrientation, showLegend, showToolTips, showUrls); return chart; }
From source file:FindHullWindowLogic.java
static void drawPointsOnChart(JPanel panelWhenInside, ArrayList<Point2D> convexHull) { panelWhenInside.removeAll();/*from ww w . ja v a 2s .c o m*/ panelWhenInside.setLayout(new java.awt.BorderLayout()); XYSeries seriersAllPoints = new XYSeries("All points"); addPointsToSeries(seriersAllPoints); int pairsNumber = 0; if (convexHull != null) pairsNumber = convexHull.size() - 1; XYSeries covnexHullDivideOnPiars[] = new XYSeries[pairsNumber]; for (int i = 0; i < covnexHullDivideOnPiars.length; i++) { covnexHullDivideOnPiars[i] = new XYSeries("Convex hull pair " + i); } if (convexHull != null) { divideOnPairsAndConvertConvexHullIntoSeries(covnexHullDivideOnPiars, convexHull); } // Add the seriersAllPoints to your data set XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(seriersAllPoints); for (int i = 0; i < covnexHullDivideOnPiars.length; i++) { dataset.addSeries(covnexHullDivideOnPiars[i]); } // Generate the graph JFreeChart chart = ChartFactory.createXYLineChart(null, // Title null, // x-axis Label null, // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation false, // Show Legend false, // Use tooltips false // Configure chart to generate URLs? ); final XYPlot plot = chart.getXYPlot(); ChartPanel chartPanel = new ChartPanel(chart); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesPaint(0, Color.BLACK); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShape(0, ShapeUtilities.createDiamond(3)); for (int i = 1; i <= covnexHullDivideOnPiars.length; i++) { renderer.setSeriesPaint(i, Color.red); renderer.setSeriesLinesVisible(i, true); renderer.setSeriesStroke(i, new BasicStroke(1.0f)); } plot.setRenderer(renderer); panelWhenInside.add(chartPanel, BorderLayout.CENTER); panelWhenInside.validate(); }
From source file:MonteCarloWindowLogic.java
static void drawPointsOnChart(JPanel panelWhenInside, ArrayList<Point2D> convexHull, ArrayList<Point2D> hits, ArrayList<Point2D> miss) { panelWhenInside.removeAll();/* w w w. ja va 2s .c om*/ panelWhenInside.setLayout(new java.awt.BorderLayout()); XYSeries seriersHits = new XYSeries("Hits"); convertArrayListToXYSeries(seriersHits, hits); XYSeries seriersMiss = new XYSeries("Miss"); convertArrayListToXYSeries(seriersMiss, miss); //TODO refactor this, to handling hits, miss and than convex hull int pairsNumber = 0; if (convexHull != null) pairsNumber = convexHull.size() - 1; XYSeries covnexHullDivideOnPiars[] = new XYSeries[pairsNumber]; for (int i = 0; i < covnexHullDivideOnPiars.length; i++) { covnexHullDivideOnPiars[i] = new XYSeries("Convex hull pair " + i); } if (convexHull != null) { divideOnPairsAndConvertConvexHullIntoSeries(covnexHullDivideOnPiars, convexHull); } // Add the seriersAllPoints to your data set XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(seriersHits); dataset.addSeries(seriersMiss); for (int i = 0; i < covnexHullDivideOnPiars.length; i++) { dataset.addSeries(covnexHullDivideOnPiars[i]); } // Generate the graph JFreeChart chart = ChartFactory.createXYLineChart(null, // Title null, // x-axis Label null, // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation false, // Show Legend false, // Use tooltips false // Configure chart to generate URLs? ); final XYPlot plot = chart.getXYPlot(); ChartPanel chartPanel = new ChartPanel(chart); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesPaint(0, Color.GREEN); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShape(0, ShapeUtilities.createDiamond(3)); renderer.setSeriesPaint(1, Color.RED); renderer.setSeriesLinesVisible(1, false); renderer.setSeriesShape(1, ShapeUtilities.createDiamond(3)); for (int i = 2; i <= covnexHullDivideOnPiars.length + 1; i++) { renderer.setSeriesPaint(i, Color.black); renderer.setSeriesLinesVisible(i, true); renderer.setSeriesStroke(i, new BasicStroke(1.0f)); } plot.setRenderer(renderer); panelWhenInside.add(chartPanel, BorderLayout.CENTER); panelWhenInside.validate(); }
From source file:rework.MainFrame.java
/** * Creates new form MainFrame// www . j a v a 2 s . 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(); }