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: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 );//from w w w .jav a2s. co 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:org.rhwlab.ace3d.SegmentationLinePlot.java
public void setTree(BHCTree tree) { XYSeriesCollection collect = new XYSeriesCollection(); XYSeries series = new XYSeries(""); collect.addSeries(series);//from w w w . j a v a 2 s . com TreeMap<Integer, TreeSet<NucleusLogNode>> map = tree.allTreeCuts(500); for (Integer i : map.keySet()) { TreeSet<NucleusLogNode> nodes = map.get(i); double lnP = nodes.first().getLogPosterior(); series.add((double) i, Math.exp(lnP)); } int t = tree.getTime(); int nu = tree.getNu(); JFreeChart chart = ChartFactory.createXYLineChart( String.format("Time=%d,nu=%d,alpha=%e", tree.getTime(), tree.getNu(), tree.getAlpha()), "Index", "Probability", collect, PlotOrientation.VERTICAL, false, true, true); XYPlot plot = (XYPlot) chart.getPlot(); ChartPanel panel = new ChartPanel(chart); this.add(panel); }
From source file:OilDrop.GraphTest.java
public JFreeChart getResultChart() { XYSeries series1 = new XYSeries("Particle Velocity"); for (double i = 0; i < 10; i++) { caculate(i / 1000.);//from w w w . j av a 2 s . c o m series1.add(i, position);//pow(v,-10)); } XYSeriesCollection data1 = new XYSeriesCollection(series1); final JFreeChart chart = ChartFactory.createXYLineChart("Time-Voltage Graph", "Time", "Voltage", data1, PlotOrientation.VERTICAL, true, false, false); chart.setBackgroundPaint(null); XYPlot plot = chart.getXYPlot(); // plot.getRangeAxis().setRange(-20, 20); return chart; }
From source file:figs.Chart.java
public Chart() { super(null, true); dataset = new XYSeriesCollection(); chart = ChartFactory.createXYLineChart("", null, null, dataset, PlotOrientation.VERTICAL, true, true, false);// w ww .j av a2 s. co m chart.setBackgroundPaint(Color.white); setChart(chart); }
From source file:sim.app.sugarscape.Charts.java
JFreeChart createTradeChart() { JFreeChart chart = ChartFactory.createXYLineChart("Trading and Population over Time", "Time", "Level", model.agents_series_coll, PlotOrientation.VERTICAL, true, true, false); model.trade_chart = chart;//w w w.ja v a2 s .c om NumberAxis rangeAxis1 = new NumberAxis("Time"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); org.jfree.chart.axis.NumberAxis domainAxis = new NumberAxis("Bins"); XYPlot plot = chart.getXYPlot(); ValueAxis xAxis = plot.getDomainAxis(); XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(0, Color.BLUE); plot.setDataset(1, model.trade_coll); XYItemRenderer rend2 = new StandardXYItemRenderer(); //if (rend2 != null) rend2.setSeriesPaint(1, Color.BLACK); plot.setRenderer(1, rend2); return chart; }
From source file:org.jfree.chart.demo.Graphic.java
public Graphic(String title) { this.title = title; mas_x.add((double) 0); mas_y.add((double) 0); dataset = new XYSeriesCollection(); chart = ChartFactory.createXYLineChart(title, "T - ", "U - ", dataset, PlotOrientation.VERTICAL, true, true, false); XYPlot plot = chart.getXYPlot();//from www . jav a2s . c o m plot.setDomainCrosshairLockedOnData(true); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setRangeCrosshairLockedOnData(true); }
From source file:com.moczul.jbacktester.Main.java
private static void showCapitalChart(XYDataset dataset) { final JFreeChart chart = ChartFactory.createXYLineChart("Capital curve", // chart title "X", // x axis label "Y", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls );// w w w .j ava 2 s.c o m final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); JFrame frame = new JFrame(); frame.setContentPane(chartPanel); frame.pack(); frame.setVisible(true); }
From source file:org.jfree.chart.demo.DeviationRendererDemo3.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart chart = ChartFactory.createXYLineChart("DeviationRenderer - Demo 3", "X", "Y", xydataset, PlotOrientation.VERTICAL, false, true, false); XYPlot plot = (XYPlot) chart.getPlot(); ///* www. j a v a2 s . c o m*/ DeviationRenderer renderer = new DeviationRenderer(false, false); renderer.setSeriesStroke(0, new BasicStroke(3F, 1, 1)); renderer.setSeriesStroke(0, new BasicStroke(3F, 1, 1)); renderer.setSeriesStroke(1, new BasicStroke(3F, 1, 1)); renderer.setSeriesFillPaint(0, Color.red); renderer.setSeriesFillPaint(1, Color.orange); renderer.setSeriesFillPaint(2, Color.green); plot.setRenderer(renderer); // DateAxis domainAxis = new DateAxis("Date"); domainAxis.setLowerMargin(0.0D); domainAxis.setUpperMargin(0.0D); plot.setDomainAxis(domainAxis); NumberAxis valueAxis = (NumberAxis) plot.getRangeAxis(); valueAxis.setRange(-40D, 40D); valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartUtilities.applyCurrentTheme(chart); return chart; }
From source file:grafica.Lineal.java
private static JFreeChart crearGrafico(XYSeriesCollection cjto_datos) { JFreeChart grafico = ChartFactory.createXYLineChart("Fitness vs. Generacin", // Ttulo "Generaciones", // Ttulo eje x "Fitness", // Ttulo eje y cjto_datos, // Datos PlotOrientation.VERTICAL, // Orientacin true, // Incluir leyenda true, // Incluir tooltips false // Incluir URLs );//ww w. j a v a2s. com return grafico; }
From source file:org.matsim.contrib.dvrp.util.chart.RouteChartUtils.java
public static JFreeChart chartRoutes(List<? extends Vehicle> vehicles) { CoordDataset lData = new CoordDataset(); for (int i = 0; i < vehicles.size(); i++) { Schedule<?> schedule = vehicles.get(i).getSchedule(); lData.addSeries(Integer.toString(i), LinkSources.createLinkSource(schedule)); }/*from w w w . ja v a2s.c o m*/ JFreeChart chart = ChartFactory.createXYLineChart("Routes", "X", "Y", lData, PlotOrientation.VERTICAL, true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setRangeGridlinesVisible(false); plot.setDomainGridlinesVisible(false); plot.setBackgroundPaint(Color.white); NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setAutoRangeIncludesZero(false); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesShapesVisible(0, true); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesItemLabelsVisible(0, true); renderer.setBaseItemLabelGenerator(new XYItemLabelGenerator() { public String generateLabel(XYDataset dataset, int series, int item) { return ((CoordDataset) dataset).getText(series, item); } }); for (int i = 1; i <= vehicles.size(); i++) { renderer.setSeriesShapesVisible(i, true); renderer.setSeriesLinesVisible(i, true); renderer.setSeriesItemLabelsVisible(i, true); } return chart; }