List of usage examples for org.jfree.data.xy XYSeries setMaximumItemCount
public void setMaximumItemCount(int maximum)
From source file:org.jfree.chart.demo.PerformanceTest1.java
public static void main5(String as[]) { XYSeries xyseries = new XYSeries("Test"); xyseries.setMaximumItemCount(4000); int i = 0;// ww w .j av a2 s .c o m for (int j = 0; j < 40000; j++) { long l = System.currentTimeMillis(); for (int k = 0; k < 4000; k++) xyseries.add(i++, Math.random()); long l1 = System.currentTimeMillis(); System.out.println(j + " --> " + (l1 - l) + " (" + Runtime.getRuntime().freeMemory() + " / " + Runtime.getRuntime().totalMemory() + ")"); } }
From source file:org.jboss.modcluster.demo.client.ChartManager.java
private XYSeries createSessionSeries(String key) { XYSeries series = new XYSeries(key); series.setMaximumItemCount(20); sessionSeries.put(key, series);/*w ww . ja v a 2 s .c o m*/ sessionSeriesCollection.addSeries(series); return series; }
From source file:org.jboss.modcluster.demo.client.ChartManager.java
private XYSeries createRequestSeries(String key) { XYSeries series = new XYSeries(key); series.setMaximumItemCount(20); requestSeries.put(key, series);/*from w ww. j a v a2 s.c om*/ requestSeriesCollection.addSeries(series); return series; }
From source file:uk.co.moonsit.rmi.GraphClient.java
private void init(String config) throws IOException { //sp = ev3.createSampleProvider(portName, sensorClass, mode); String[] pars = config.split(";"); String labels = pars[0];//from ww w.j ava 2s. c o m String category = pars[1]; String units = pars[2]; //int minValue = Integer.parseInt(pars[3]); //int maxValue = Integer.parseInt(pars[4]); if (log) { openFile(labels); } String[] labelsArray = labels.split(","); //seriesArray = new XYSeries[labelsArray.length]; int i = 0; for (String label : labelsArray) { XYSeries series = new XYSeries(label); series.setMaximumItemCount(dataLength); dataset.addSeries(series); //seriesArray[i++] = series; } JFreeChart chart = ChartFactory.createXYLineChart(title, category, units, (XYDataset) dataset, PlotOrientation.VERTICAL, true, true, false); ChartPanel chartPanel = new ChartPanel(chart); //chartPanel.setMinimumSize(new Dimension(windowWidth, windowHeight)); chartPanel.setPreferredSize(new Dimension(windowWidth, windowHeight)); setContentPane(chartPanel); //XYPlot plot = chart.getXYPlot(); //NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); //rangeAxis.setRange(minValue, maxValue); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); }
From source file:com.romraider.logger.ecu.ui.handler.graph.GraphUpdateHandler.java
private void registerSeries(LoggerData loggerData) { final XYSeries series = new XYSeries(loggerData.getName()); series.setMaximumItemCount(200); seriesMap.put(loggerData, series);/*w w w .j a va 2s . c o m*/ }
From source file:de.nomagic.printerController.gui.TemperaturePanel.java
/** a temperature reading arrived from the Client. * *///from www . j av a2s . c o m @Override public void update(Heater_enum position, double temperature) { // TODO Thread Sync problem ??? XYSeries curSeries = data[position.ordinal()]; if (null == curSeries) { // first Temperature Report on this Heater curSeries = new XYSeries(position.toString()); curSeries.setMaximumItemCount(MAXIMUM_ITEM_COUNT); data[position.ordinal()] = curSeries; dataset.addSeries(curSeries); } // else nothing to do if (Protocol.LOWEST_POSSIBLE_TEMPERATURE < temperature) { long curTime = System.currentTimeMillis(); curTime = curTime - startTime; curSeries.add(curTime, temperature); } else { // Invalid Temperature reported -> ignore the value } if (TimeoutHandler.ERROR_FAILED_TO_CREATE_TIMEOUT == timeOutId[position.getValue()]) { // first Time this Heater reports a Temperature -> create a timeout final Event e = new Event(Action_enum.timeOut, position, this); timeOutId[position.getValue()] = timeOut.createTimeout(e, MAXIMUM_TIME_BETWEEN_TEMPERATURE_MEASUREMENT_MS); } timeOut.startTimeout(timeOutId[position.getValue()]); }
From source file:uk.co.moonsit.sockets.GraphClient.java
private JFreeChart initChart(String config) { logger.info("+++ initChart start "); String[] pars = config.split(";"); String labels = pars[0];/* w w w . j a v a 2 s .c o m*/ String category = pars[1]; //String units = pars[2]; String[] labelsArray = labels.split(","); //seriesArray = new XYSeries[labelsArray.length]; datasets = new XYSeriesCollection[labelsArray.length]; JFreeChart chart = ChartFactory.createXYLineChart(null, category, null, (XYDataset) datasets[0], PlotOrientation.VERTICAL, true, true, false); int j = 0; int[] axesIndex = new int[labelsArray.length]; for (String label_ind : labelsArray) { String[] liArr = label_ind.split("_"); XYSeries series = new XYSeries(liArr[0]); axesIndex[j] = Integer.parseInt(liArr[1]); series.setMaximumItemCount(dataLength); datasets[j] = new XYSeriesCollection(); datasets[j].addSeries(series); //seriesArray[i++] = series; j++; } XYPlot plot = chart.getXYPlot(); setAxes(plot, axesIndex); setSubtitles(chart, labelsArray); setSeriesColors(plot); return chart; }
From source file:com.jbombardier.console.charts.XYTimeChartPanel.java
protected XYSeries getSeriesForSource(String label) { XYSeries xySeries; synchronized (seriesForSource) { xySeries = seriesForSource.get(label); if (xySeries == null) { xySeries = new XYSeries(label); int seriesIndex = xyseriescollection.getSeriesCount(); xyseriescollection.addSeries(xySeries); xySeries.setMaximumItemCount(datapoints); seriesForSource.put(label, xySeries); if (lineFormatController != null) { Paint paint = lineFormatController.allocateColour(label); XYPlot xyPlot = chart.getXYPlot(); XYItemRenderer xyir = xyPlot.getRenderer(); xyir.setSeriesPaint(seriesIndex, paint); Stroke stroke = lineFormatController.getStroke(label); xyir.setSeriesStroke(seriesIndex, stroke); }/*www. j a va 2 s . c om*/ } } return xySeries; }
From source file:org.jfree.data.xy.XYSeriesTest.java
/** * Check that the item bounds are determined correctly when there is a * maximum item count.//from ww w .j av a 2 s. co m */ @Test public void testSetMaximumItemCount4() { XYSeries s1 = new XYSeries("S1"); s1.setMaximumItemCount(2); s1.add(1.0, 1.1); s1.add(2.0, 2.2); s1.add(3.0, 3.3); assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON); assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON); assertEquals(2.0, s1.getMinX(), EPSILON); assertEquals(3.0, s1.getMaxX(), EPSILON); assertEquals(2.2, s1.getMinY(), EPSILON); assertEquals(3.3, s1.getMaxY(), EPSILON); }
From source file:org.jfree.data.xy.XYSeriesTest.java
/** * A simple check that the maximumItemCount attribute is working. *///from ww w .ja va 2 s. com @Test public void testSetMaximumItemCount() { XYSeries s1 = new XYSeries("S1"); assertEquals(Integer.MAX_VALUE, s1.getMaximumItemCount()); s1.setMaximumItemCount(2); assertEquals(2, s1.getMaximumItemCount()); s1.add(1.0, 1.1); s1.add(2.0, 2.2); s1.add(3.0, 3.3); assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON); assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON); }