List of usage examples for org.jfree.data.xy XYSeriesCollection XYSeriesCollection
public XYSeriesCollection()
From source file:org.sonar.server.charts.deprecated.SparkLinesChart.java
private void configureDataset() { dataset = new XYSeriesCollection(); }
From source file:ANNFileDetect.GraphingClass.java
public JFreeChart RenderFiles(TreeMap finalMap) { XYSeriesCollection ds = new XYSeriesCollection(); Iterator entries = finalMap.entrySet().iterator(); while (entries.hasNext()) { Entry thisentry = (Entry) entries.next(); String key = (String) thisentry.getKey(); TreeMap<Double, Integer> tm = (TreeMap) thisentry.getValue(); XYSeries series = new XYSeries(key); //HashMap<Double, Integer> tmp = finalMap.get(key); for (Map.Entry<Double, Integer> entry : tm.entrySet()) { //ds.addValue(ht.get(tmp), "Times", tmp); series.add(entry.getKey(), entry.getValue()); }/*from w ww .j av a 2 s .co m*/ ds.addSeries(series); } JFreeChart chart = ChartFactory.createXYLineChart("Test graph", "Value", "Times", ds, PlotOrientation.VERTICAL, true, true, false); XYLineAndShapeRenderer rend = (XYLineAndShapeRenderer) chart.getXYPlot().getRenderer(); rend.setBaseShape(new Rectangle(-2, -2, 4, 4)); rend.setBaseShapesVisible(true); rend.setBaseSeriesVisible(true); //rend.setSeriesVisible(i, true); chart.getXYPlot().setRenderer(rend); return chart; }
From source file:org.hxzon.demo.jfreechart.PolarChartDemo.java
private static XYDataset createDataset1() { boolean notify = false; XYSeriesCollection dataset = new XYSeriesCollection(); XYSeries series1 = new XYSeries(series1Name); //(theta,radius) series1.add(10, 2, notify);/* w w w . j a va 2 s.c o m*/ series1.add(20, 4, notify); series1.add(30, 6, notify); dataset.addSeries(series1); return dataset; }
From source file:flusim.XY_Plotter.java
/** * Creates a dataset, consisting of two series of monthly data. * * @return The dataset./*from w w w. j a va 2 s .c o m*/ */ private static XYDataset createDataset(java.util.List[] data, String[] desc) { //data is an arraylist of arraylists int count = data.length; XYSeriesCollection dataset = new XYSeriesCollection(); for (int i = 0; i < count; i++) { XYSeries xys = new XYSeries(desc[i]); java.util.List Data = data[i]; int elements = Data.size(); for (int j = 0; j < elements; j++) { double[] timepoint = (double[]) Data.get(j); xys.add(timepoint[0], timepoint[1]); } dataset.addSeries(xys); } return dataset; }
From source file:network.Draw.java
private static XYDataset createDataset(int method) { XYSeries tempreture = new XYSeries("Tempreture"); String output = null;/*from w ww.j a v a 2 s . c o m*/ String url = "http://localhost/server/dia.php"; System.out.println(url); try { if (method == 0) { output = HTTP.getHTML(url); System.out.println("get"); } else { output = HTTP.postHTML(url, ""); System.out.println("post"); } } catch (Exception ex) { Logger.getLogger(Draw.class.getName()).log(Level.SEVERE, null, ex); } System.out.println(output); String[] strArray = output.split("&"); //String data[] = output.split("&"); // // for(int i=0;i<10;i++){ // System.out.print(data[i]); // } int x, y; for (int i = strArray.length - 10; i < strArray.length;) { x = Integer.parseInt(strArray[i]); y = Integer.parseInt(strArray[i + 1]); System.out.print(x + ":" + y + "\n"); tempreture.add(x, y); i = i + 2; } // final XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(tempreture); return dataset; }
From source file:com.choicemaker.cm.modelmaker.gui.panels.HoldVsAccuracyPlotPanel.java
private void buildPanel() { XYSeriesCollection dataset = new XYSeriesCollection(); String title = ChoiceMakerCoreMessages.m.formatMessage("train.gui.modelmaker.panel.holdvsacc.title"); data = new XYSeries(title); dataset.addSeries(data);/* w w w . j a v a 2 s . c o m*/ final PlotOrientation orientation = PlotOrientation.VERTICAL; chart = ChartFactory.createXYLineChart(title, ChoiceMakerCoreMessages.m.formatMessage("train.gui.modelmaker.panel.holdvsacc.cm.accuracy"), ChoiceMakerCoreMessages.m.formatMessage("train.gui.modelmaker.panel.holdvsacc.holdpercentage"), dataset, orientation, true, true, true); MouseListener tableMouseListener = new MouseAdapter() { public void mousePressed(MouseEvent e) { Point origin = e.getPoint(); JTable src = (JTable) e.getSource(); int row = src.rowAtPoint(origin); int col = src.columnAtPoint(origin); ModelMaker mm = parent.getModelMaker(); if (src == accuracyTable) { if (col < 2) { if (!Float.isNaN(accuracyData[row][2]) && !Float.isNaN(accuracyData[row][3])) mm.setThresholds(new Thresholds(accuracyData[row][2], accuracyData[row][3])); } else if (col == 2) { if (!Float.isNaN(accuracyData[row][2])) mm.setDifferThreshold(accuracyData[row][2]); } else { if (!Float.isNaN(accuracyData[row][3])) mm.setMatchThreshold(accuracyData[row][3]); } } else { if (col < 2) { if (!Float.isNaN(hrData[row][2]) && !Float.isNaN(hrData[row][3])) mm.setThresholds(new Thresholds(hrData[row][2], hrData[row][3])); } else if (col == 2) { if (!Float.isNaN(hrData[row][2])) mm.setDifferThreshold(hrData[row][2]); } else { if (!Float.isNaN(hrData[row][3])) mm.setMatchThreshold(hrData[row][3]); } } } }; chart.setBackgroundPaint(getBackground()); accuracyTable = new AccuracyTable(true, accuracies); accuracyTable.addMouseListener(tableMouseListener); accuracyPanel = getPanel(accuracyTable, ChoiceMakerCoreMessages.m.formatMessage("train.gui.modelmaker.panel.holdvsacc.table.hrvsacc")); hrTable = new AccuracyTable(false, hrs); hrTable.addMouseListener(tableMouseListener); hrPanel = getPanel(hrTable, ChoiceMakerCoreMessages.m.formatMessage("train.gui.modelmaker.panel.holdvsacc.table.accvshr")); accuracyTable.setEnabled(false); hrTable.setEnabled(false); }
From source file:net.nosleep.superanalyzer.analysis.views.YearView.java
private void createPanel() { _comboBox = new JComboBox(_analysis.getComboBoxItems()); _comboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { refreshDataset();//from ww w .j a va 2s . c o m } }); _dataset = new XYSeriesCollection(); createChart(); _chartPanel = new ChartPanel(_chart); _chartPanel.setMouseWheelEnabled(true); refreshDataset(); }
From source file:org.jfree.chart.demo.XYLogAxesDemo.java
/** * Creates a new demo./*from w w w .jav a 2 s . c o m*/ * * @param title the frame title. */ public XYLogAxesDemo(final String title) { super(title); //Object[][][] data = new Object[3][50][2]; final XYSeries s1 = new XYSeries("Series 1"); final XYSeries s2 = new XYSeries("Series 2"); final XYSeries s3 = new XYSeries("Series 3"); // for (int i = 1; i <= 50; i++) { // s1.add(i, 1000 * Math.pow(i, -2)); // s2.add(i, 1000 * Math.pow(i, -3)); // s3.add(i, 1000 * Math.pow(i, -4)); // } for (int i = 1; i <= 50; i++) { s1.add(i, 10 * Math.exp(i / 5.0)); s2.add(i, 20 * Math.exp(i / 5.0)); s3.add(i, 30 * Math.exp(i / 5.0)); } final XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(s1); dataset.addSeries(s2); dataset.addSeries(s3); final JFreeChart chart = ChartFactory.createXYLineChart("Log Axis Demo", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, false); final XYPlot plot = chart.getXYPlot(); final NumberAxis domainAxis = new NumberAxis("x"); final NumberAxis rangeAxis = new LogarithmicAxis("Log(y)"); plot.setDomainAxis(domainAxis); plot.setRangeAxis(rangeAxis); chart.setBackgroundPaint(Color.white); plot.setOutlinePaint(Color.black); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); }
From source file:ch.zhaw.init.walj.projectmanagement.util.chart.LineChart.java
/** * creates a dataset with all data about planned and booked effort * @return dataset with planned and booked PMs * @throws SQLException//from ww w . j a v a 2 s .com */ private XYDataset createDataset() throws SQLException { // initialize variables Effort effort = new Effort(tasks, path); double plannedEffort = 0; double bookedEffort = 0; XYSeries planned = new XYSeries("Planned"); XYSeries booked = new XYSeries("Booked"); int projectMonths = project.getNumberOfMonths(); // get planned and booked effort for every month for (double i = 1; i <= projectMonths; i++) { effort.getPlannedEffort(i); plannedEffort += effort.getPlannedEffort(i); planned.add(i, plannedEffort); if (effort.getBookedEffort(i) != 0) { bookedEffort += effort.getBookedEffort(i); booked.add(i, bookedEffort); } } // add booked and planned effort to dataset XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(booked); dataset.addSeries(planned); return dataset; }
From source file:com.choicemaker.cm.modelmaker.gui.panels.AsymmetricThresholdVsAccuracyPlotPanel.java
private JFreeChart buildPlot(XYSeries d, XYSeries m, String title, String xAxis) { XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(d);//www .ja v a 2 s. co m dataset.addSeries(m); final String yAxis = ChoiceMakerCoreMessages.m .formatMessage("train.gui.modelmaker.panel.asymm.cm.accuracy"); final PlotOrientation orientation = PlotOrientation.VERTICAL; final boolean hasLegend = true; final boolean hasToolTips = true; final boolean hasURLs = true; JFreeChart chart = // ChartFactory.createLineXYChart( // title, // xAxis, // ChoiceMakerCoreMessages.m.formatMessage("train.gui.modelmaker.panel.asymm.cm.accuracy"), // dataset, // true, true, true); ChartFactory.createXYLineChart(title, xAxis, yAxis, dataset, orientation, hasLegend, hasToolTips, hasURLs); chart.setBackgroundPaint(getBackground()); return chart; }