List of usage examples for org.jfree.data.time TimeSeries setMaximumItemCount
public void setMaximumItemCount(int maximum)
From source file:org.jfree.chart.demo.PerformanceTest1.java
public static void main4(String as[]) { TimeSeries timeseries = new TimeSeries("Test"); timeseries.setMaximumItemCount(4000); FixedMillisecond fixedmillisecond = new FixedMillisecond(); for (int i = 0; i < 40000; i++) { long l = System.currentTimeMillis(); for (int j = 0; j < 400; j++) { fixedmillisecond = (FixedMillisecond) fixedmillisecond.next(); timeseries.add(fixedmillisecond, Math.random()); }//from w w w .j a va 2s. c o m long l1 = System.currentTimeMillis(); System.out.println(i + " --> " + (l1 - l) + " (" + Runtime.getRuntime().freeMemory() + " / " + Runtime.getRuntime().totalMemory() + ")"); } }
From source file:pt.lsts.neptus.console.plugins.AirOSPeers.java
private void process(Station station) { String name = nameOf(station); TimeSeries ts = tsc.getSeries(name); if (ts == null) { ts = new TimeSeries(name); ts.setMaximumItemCount(250); tsc.addSeries(ts);/* www. j av a 2 s . com*/ } ts.addOrUpdate(new Millisecond(new Date(System.currentTimeMillis())), station.ccq); if (logToDisk) { RSSI rssi = new RSSI(); rssi.setValue(station.ccq); rssi.setSrcEnt(entityOf(name + " wifi")); rssi.setSrc(ImcMsgManager.getManager().getLocalId().intValue()); rssi.setDst(65535); LsfMessageLogger.log(rssi); } }
From source file:org.streamspinner.harmonica.application.CQGraphTerminal.java
private TimeSeries updateTimeSeries(String name, int col, double val) { TimeSeries ts = c.getSeries(name); if (ts == null) { ts = new TimeSeries(name, Millisecond.class); ts.setMaximumItemCount(100); col_series_map.put(col, ts);//from w w w. ja v a2s.c o m c.addSeries(ts); } if (Double.isNaN(val)) { ts.add(getMillisecond(), null); } else { ts.add(getMillisecond(), val); } return ts; }
From source file:org.openiot.gsn.vsensor.ChartVirtualSensor.java
/** * This method adds the specified stream elements to the timeSeries of the * appropriate plot.//from w w w . j a v a2 s . c o m * * @param streamElement */ public synchronized void addData(StreamElement streamElement) { for (int i = 0; i < streamElement.getFieldNames().length; i++) { TimeSeries timeSeries = dataForTheChart.get(streamElement.getFieldNames()[i]); if (timeSeries == null) { dataForTheChart.put(streamElement.getFieldNames()[i], timeSeries = new TimeSeries(streamElement.getFieldNames()[i], org.jfree.data.time.FixedMillisecond.class)); timeSeries.setMaximumItemCount(historySize); dataCollectionForTheChart.addSeries(timeSeries); } try { timeSeries.addOrUpdate(new FixedMillisecond(new Date(streamElement.getTimeStamp())), Double.parseDouble(streamElement.getData()[i].toString())); } catch (SeriesException e) { logger.warn(e.getMessage(), e); } } changed = true; }
From source file:gsn.vsensor.ChartVirtualSensor.java
/** * This method adds the specified stream elements to the timeSeries of the * appropriate plot./*from w w w . j a va 2s.co m*/ * * @param streamElement */ public synchronized void addData(StreamElement streamElement) { for (int i = 0; i < streamElement.getFieldNames().length; i++) { TimeSeries timeSeries = dataForTheChart.get(streamElement.getFieldNames()[i]); if (timeSeries == null) { dataForTheChart.put(streamElement.getFieldNames()[i], timeSeries = new TimeSeries(streamElement.getFieldNames()[i], org.jfree.data.time.FixedMillisecond.class)); if (isTimeBased) { timeSeries.setMaximumItemAge(historySize); } else { timeSeries.setMaximumItemCount(historySize); } dataCollectionForTheChart.addSeries(timeSeries); } try { timeSeries.addOrUpdate(new FixedMillisecond(new Date(streamElement.getTimeStamp())), Double.parseDouble(streamElement.getData()[i].toString())); } catch (SeriesException e) { logger.warn(e.getMessage(), e); } } changed = true; }
From source file:org.jfree.data.time.junit.TimeSeriesTest.java
/** * Test the add branch of the addOrUpdate() method. *///from ww w .ja va 2 s .co m public void testAddOrUpdate2() { TimeSeries s1 = new TimeSeries("S1"); s1.setMaximumItemCount(2); s1.addOrUpdate(new Year(2010), 1.1); s1.addOrUpdate(new Year(2011), 2.2); s1.addOrUpdate(new Year(2012), 3.3); assertEquals(2, s1.getItemCount()); assertEquals(2.2, s1.getMinY(), EPSILON); assertEquals(3.3, s1.getMaxY(), EPSILON); }
From source file:org.jfree.data.time.junit.TimeSeriesTest.java
/** * Check that the item bounds are determined correctly when there is a * maximum item count and a new value is added. *//* w ww . j a v a2 s.c om*/ public void testAdd() { TimeSeries s1 = new TimeSeries("S1"); s1.setMaximumItemCount(2); s1.add(new Year(2010), 1.1); s1.add(new Year(2011), 2.2); s1.add(new Year(2012), 3.3); assertEquals(2, s1.getItemCount()); assertEquals(2.2, s1.getMinY(), EPSILON); assertEquals(3.3, s1.getMaxY(), EPSILON); }
From source file:org.jfree.data.time.junit.TimeSeriesTest.java
/** * Some checks for the addOrUpdate() method. *//* ww w . ja v a2 s .com*/ public void testAddOrUpdate() { TimeSeries s1 = new TimeSeries("S1"); s1.setMaximumItemCount(2); s1.addOrUpdate(new Year(2000), 100.0); assertEquals(1, s1.getItemCount()); s1.addOrUpdate(new Year(2001), 101.0); assertEquals(2, s1.getItemCount()); s1.addOrUpdate(new Year(2001), 102.0); assertEquals(2, s1.getItemCount()); s1.addOrUpdate(new Year(2002), 103.0); assertEquals(2, s1.getItemCount()); }
From source file:org.jfree.data.time.TimeSeriesTest.java
/** * Test the add branch of the addOrUpdate() method. *//*from w ww .j a v a2 s . co m*/ @Test public void testAddOrUpdate2() { TimeSeries s1 = new TimeSeries("S1"); s1.setMaximumItemCount(2); s1.addOrUpdate(new Year(2010), 1.1); s1.addOrUpdate(new Year(2011), 2.2); s1.addOrUpdate(new Year(2012), 3.3); assertEquals(2, s1.getItemCount()); assertEquals(2.2, s1.getMinY(), EPSILON); assertEquals(3.3, s1.getMaxY(), EPSILON); }
From source file:org.jfree.data.time.TimeSeriesTest.java
/** * Check that the item bounds are determined correctly when there is a * maximum item count and a new value is added. *///from w ww. j av a 2 s . c o m @Test public void testAdd() { TimeSeries s1 = new TimeSeries("S1"); s1.setMaximumItemCount(2); s1.add(new Year(2010), 1.1); s1.add(new Year(2011), 2.2); s1.add(new Year(2012), 3.3); assertEquals(2, s1.getItemCount()); assertEquals(2.2, s1.getMinY(), EPSILON); assertEquals(3.3, s1.getMaxY(), EPSILON); }