List of usage examples for org.jfree.chart.plot XYPlot setDataset
public void setDataset(XYDataset dataset)
From source file:br.ufrgs.enq.jcosmo.test.VLEdiagrams.java
@SuppressWarnings("deprecation") public JPanel calcEthTol() throws Exception { super.setTitle("P vs x1"); double T = 60; setLayout(new BorderLayout()); COSMOSACDataBase db = COSMOSACDataBase.getInstance(); COSMOSACCompound comps[] = new COSMOSACCompound[2]; comps[0] = db.getComp("ethanol"); comps[1] = db.getComp("toluene"); COSMOSAC cosmosac = new COSMOSAC(); cosmosac.setComponents(comps);/*from w w w . j ava 2s . c o m*/ cosmosac.setTemperature(T + 273.15); double[] x1 = new double[n]; double[] x2 = new double[n]; double[] gamma1 = new double[n]; double[] gamma2 = new double[n]; double[] z = new double[2]; double[] lnGamma = new double[2]; z[0] = 0.00; int j = 0; while (z[0] < 1.0001) { z[1] = 1 - z[0]; x1[j] = z[0]; x2[j] = z[1]; cosmosac.setComposition(z); cosmosac.activityCoefficient(lnGamma); gamma1[j] = Math.exp(lnGamma[0]); gamma2[j] = Math.exp(lnGamma[1]); z[0] += 0.05; j++; } double[][] parAntoine = new double[3][3]; parAntoine[0][0] = 16.8958; parAntoine[0][1] = 3795.17; parAntoine[0][2] = 230.918; parAntoine[1][0] = 13.9320; parAntoine[1][1] = 3056.96; parAntoine[1][2] = 217.625; double[] Psat = pSat(parAntoine, T); double[] P = calcPx(x1, x2, gamma1, gamma2, Psat); double[] y1 = calcY(x1, gamma1, Psat, P); XYPlot plot1; XYSeriesCollection dataset = new XYSeriesCollection(); XYSeries liq = new XYSeries("liquid"); XYSeries vap = new XYSeries("vapor"); XYSeries raoult = new XYSeries("Raoult's Law"); for (int i = 0; i < n; i++) { liq.add(x1[i], P[i]); vap.add(y1[i], P[i]); } raoult.add(0, Psat[1]); raoult.add(1, Psat[0]); dataset.addSeries(liq); dataset.addSeries(vap); dataset.addSeries(raoult); JFreeChart chart = ChartFactory.createXYLineChart(null, "Mole Fraction: x1, y1", "P/KPa", null, PlotOrientation.VERTICAL, true, true, false); plot1 = (XYPlot) chart.getPlot(); plot1.getDomainAxis().setRange(new Range(0.0, 1.0)); plot1.getRangeAxis().setRange(new Range(15.0, 50.0)); plot1.setDataset(dataset); XYSplineRenderer r = new XYSplineRenderer(); BasicStroke stroke = new BasicStroke(2f); r.setStroke(stroke); plot1.setRenderer(r); r.setBaseShapesVisible(false); ChartPanel chartPanel = new ChartPanel(chart); JPanel jp = new JPanel(new BorderLayout()); jp.add(chartPanel); add(jp, BorderLayout.CENTER); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(400, 500); return jp; }
From source file:br.ufrgs.enq.jcosmo.test.VLEdiagrams.java
/** * VLE diagrams using sigma profile by MOPAC * //from w w w .j a v a 2 s . com * @return * @throws Exception */ @SuppressWarnings("deprecation") public JPanel calcEthTolMOPAC() throws Exception { super.setTitle("P vs x1"); double T = 60; setLayout(new BorderLayout()); COSMOSACDataBase db = COSMOSACDataBase.getInstance(); COSMOSACCompound comps[] = new COSMOSACCompound[2]; comps[0] = db.getComp("ethanol"); comps[1] = db.getComp("toluene"); COSMOSAC cosmosac = new COSMOPAC(); cosmosac.setComponents(comps); cosmosac.setTemperature(T + 273.15); double[] x1 = new double[n]; double[] x2 = new double[n]; double[] gamma1 = new double[n]; double[] gamma2 = new double[n]; double[] z = new double[2]; double[] lnGamma = new double[2]; z[0] = 0.00; int j = 0; while (z[0] < 1.0001) { z[1] = 1 - z[0]; x1[j] = z[0]; x2[j] = z[1]; cosmosac.setComposition(z); cosmosac.activityCoefficient(lnGamma); gamma1[j] = Math.exp(lnGamma[0]); gamma2[j] = Math.exp(lnGamma[1]); z[0] += 0.05; j++; } double[][] parAntoine = new double[3][3]; parAntoine[0][0] = 16.8958; parAntoine[0][1] = 3795.17; parAntoine[0][2] = 230.918; parAntoine[1][0] = 13.9320; parAntoine[1][1] = 3056.96; parAntoine[1][2] = 217.625; double[] Psat = pSat(parAntoine, T); double[] P = calcPx(x1, x2, gamma1, gamma2, Psat); double[] y1 = calcY(x1, gamma1, Psat, P); XYPlot plot1; XYSeriesCollection dataset = new XYSeriesCollection(); XYSeries liq = new XYSeries("liquid"); XYSeries vap = new XYSeries("vapor"); XYSeries raoult = new XYSeries("Raoult's Law"); for (int i = 0; i < n; i++) { liq.add(x1[i], P[i]); vap.add(y1[i], P[i]); } ; raoult.add(0, Psat[1]); raoult.add(1, Psat[0]); dataset.addSeries(liq); dataset.addSeries(vap); dataset.addSeries(raoult); JFreeChart chart = ChartFactory.createXYLineChart(null, "Mole Fraction: x1, y1", "P/KPa", null, PlotOrientation.VERTICAL, true, true, false); plot1 = (XYPlot) chart.getPlot(); plot1.getDomainAxis().setRange(new Range(0.0, 1.0)); plot1.getRangeAxis().setRange(new Range(15.0, 50.0)); plot1.setDataset(dataset); XYSplineRenderer r = new XYSplineRenderer(); BasicStroke stroke = new BasicStroke(2f); r.setStroke(stroke); plot1.setRenderer(r); r.setBaseShapesVisible(false); ChartPanel chartPanel = new ChartPanel(chart); JPanel jp = new JPanel(new BorderLayout()); jp.add(chartPanel); add(jp, BorderLayout.CENTER); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(400, 500); return jp; }
From source file:org.mwc.debrief.track_shift.views.StackedDotHelper.java
/** * ok, our track has been dragged, calculate the new series of offsets * //from www . j a v a2s . c o m * @param linePlot * @param dotPlot * @param onlyVis * @param holder * @param logger * * @param currentOffset * how far the current track has been dragged */ public void updateFrequencyData(final XYPlot dotPlot, final XYPlot linePlot, final TrackDataProvider tracks, final boolean onlyVis, final Composite holder, final ErrorLogger logger, final boolean updateDoublets) { // do we have anything? if (_primaryTrack == null) return; // ok, find the track wrappers if (_secondaryTrack == null) initialise(tracks, false, onlyVis, holder, logger, "Frequency", false, true); // ok - the tracks have moved. better update the doublets if (updateDoublets) updateDoublets(onlyVis, false, true); // aah - but what if we've ditched our doublets? // aah - but what if we've ditched our doublets? if ((_primaryDoublets == null) || (_primaryDoublets.size() == 0)) { // better clear the plot dotPlot.setDataset(null); linePlot.setDataset(null); return; } // create the collection of series final TimeSeriesCollection errorSeries = new TimeSeriesCollection(); final TimeSeriesCollection actualSeries = new TimeSeriesCollection(); // produce a dataset for each track final TimeSeries errorValues = new TimeSeries(_primaryTrack.getName()); final TimeSeries measuredValues = new TimeSeries("Measured"); final TimeSeries correctedValues = new TimeSeries("Corrected"); final TimeSeries predictedValues = new TimeSeries("Predicted"); final TimeSeries baseValues = new TimeSeries("Base"); // ok, run through the points on the primary track final Iterator<Doublet> iter = _primaryDoublets.iterator(); while (iter.hasNext()) { final Doublet thisD = iter.next(); try { final Color thisColor = thisD.getColor(); final double measuredFreq = thisD.getMeasuredFrequency(); final HiResDate currentTime = thisD.getDTG(); final FixedMillisecond thisMilli = new FixedMillisecond(currentTime.getDate().getTime()); final ColouredDataItem mFreq = new ColouredDataItem(thisMilli, measuredFreq, thisColor, false, null); // final ColouredDataItem corrFreq = new ColouredDataItem( // new FixedMillisecond(currentTime.getDate().getTime()), // correctedFreq, thisColor, false, null); measuredValues.add(mFreq); // do we have target data? if (thisD.getTarget() != null) { final double correctedFreq = thisD.getCorrectedFrequency(); final double baseFreq = thisD.getBaseFrequency(); final Color calcColor = thisD.getTarget().getColor(); final ColouredDataItem corrFreq = new ColouredDataItem(thisMilli, correctedFreq, thisColor, true, null); // did we get a base frequency? We may have a track // with a section of data that doesn't have frequency, you see. if (baseFreq != Doublet.INVALID_BASE_FREQUENCY) { final double predictedFreq = thisD.getPredictedFrequency(); final double thisError = thisD.calculateFreqError(measuredFreq, predictedFreq); final ColouredDataItem bFreq = new ColouredDataItem(thisMilli, baseFreq, thisColor, true, null); final ColouredDataItem pFreq = new ColouredDataItem(thisMilli, predictedFreq, calcColor, false, null); final ColouredDataItem eFreq = new ColouredDataItem(thisMilli, thisError, thisColor, false, null); baseValues.add(bFreq); predictedValues.add(pFreq); errorValues.add(eFreq); } correctedValues.add(corrFreq); } } catch (final SeriesException e) { CorePlugin.logError(Status.INFO, "some kind of trip whilst updating frequency plot", e); } } // ok, add these new series if (errorValues.getItemCount() > 0) errorSeries.addSeries(errorValues); actualSeries.addSeries(measuredValues); actualSeries.addSeries(correctedValues); if (predictedValues.getItemCount() > 0) actualSeries.addSeries(predictedValues); if (baseValues.getItemCount() > 0) actualSeries.addSeries(baseValues); dotPlot.setDataset(errorSeries); linePlot.setDataset(actualSeries); }
From source file:de.tud.kom.p2psim.impl.skynet.visualization.MetricsPlot.java
private void updateChartPanel(String plotTitle) { XYPlot plot = (XYPlot) chart.getPlot(); YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();// (YIntervalSeriesCollection) // plot.getDataset() String[] names = displayedSeries.keySet().toArray(new String[displayedSeries.keySet().size()]); Arrays.sort(names, null);//from www . j a v a2 s .c o m if (!autoScrolling && displayedSeries.get(names[0]).getDataSeries().getItemCount() == displayedSeries .get(names[0]).getDataSeries().getMaximumItemCount()) { autoScrolling = true; DateAxis domain = (DateAxis) plot.getDomainAxis(); domain.setAutoRange(true); plot.setDomainAxis(domain); } for (int i = 0; i < names.length; i++) { if (names[i].startsWith("Min_")) { if (showMin) dataset.addSeries(displayedSeries.get(names[i]).getDataSeries()); } else if (names[i].startsWith("Max_")) { if (showMax) dataset.addSeries(displayedSeries.get(names[i]).getDataSeries()); } else { dataset.addSeries(displayedSeries.get(names[i]).getDataSeries()); } } plot.setDataset(dataset); plot.setRenderer(configureRendererForDataSet(plot.getRenderer(), dataset)); plotPanel.setChart(chart); setSizeOfComponent(plotPanel, new Dimension(plotWidth, plotHeight)); container.add(plotPanel, BorderLayout.CENTER); setSizeOfComponent(container, new Dimension(plotWidth, plotHeight + boxOffset)); }
From source file:com.att.aro.ui.view.diagnostictab.plot.CameraPlot.java
@Override public void populate(XYPlot plot, AROTraceData analysis) { XYIntervalSeriesCollection cameraData = new XYIntervalSeriesCollection(); if (analysis != null) { XYIntervalSeries series = new XYIntervalSeries(CameraState.CAMERA_ON); cameraData.addSeries(series);// w w w . ja v a 2 s . c o m // Populate the data set Iterator<CameraInfo> iter = analysis.getAnalyzerResult().getTraceresult().getCameraInfos().iterator(); if (iter.hasNext()) { while (iter.hasNext()) { CameraInfo cameraEvent = iter.next(); if (cameraEvent.getCameraState() == CameraState.CAMERA_ON) { series.add(cameraEvent.getBeginTimeStamp(), cameraEvent.getBeginTimeStamp(), cameraEvent.getEndTimeStamp(), 0.5, 0, 1); } } } // Assign ToolTip to renderer XYItemRenderer renderer = plot.getRenderer(); renderer.setBaseToolTipGenerator(new XYToolTipGenerator() { @Override public String generateToolTip(XYDataset dataset, int series, int item) { return MessageFormat.format(ResourceBundleHelper.getMessageString("camera.tooltip"), dataset.getX(series, item), ResourceBundleHelper.getEnumString((Enum<?>) dataset.getSeriesKey(series))); } }); } plot.setDataset(cameraData); // return plot; }
From source file:org.peerfact.impl.service.aggregation.skyeye.visualization.MetricsPlot.java
private void updateChartPanel(String plotTitle) { XYPlot plot = (XYPlot) chart.getPlot(); YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();// (YIntervalSeriesCollection) // plot.getDataset() String[] names = displayedSeries.keySet().toArray(new String[displayedSeries.keySet().size()]); Arrays.sort(names, null);/*from w w w.jav a2 s .co m*/ if (!autoScrolling && displayedSeries.get(names[0]).getDataSeries().getItemCount() == displayedSeries .get(names[0]).getDataSeries().getMaximumItemCount()) { autoScrolling = true; DateAxis domain = (DateAxis) plot.getDomainAxis(); domain.setAutoRange(true); plot.setDomainAxis(domain); } for (int i = 0; i < names.length; i++) { if (names[i].startsWith("Min_")) { if (showMin) { dataset.addSeries(displayedSeries.get(names[i]).getDataSeries()); } } else if (names[i].startsWith("Max_")) { if (showMax) { dataset.addSeries(displayedSeries.get(names[i]).getDataSeries()); } } else { dataset.addSeries(displayedSeries.get(names[i]).getDataSeries()); } } plot.setDataset(dataset); plot.setRenderer(configureRendererForDataSet(plot.getRenderer(), dataset)); plotPanel.setChart(chart); setSizeOfComponent(plotPanel, new Dimension(plotWidth, plotHeight)); container.add(plotPanel, BorderLayout.CENTER); setSizeOfComponent(container, new Dimension(plotWidth, plotHeight + boxOffset)); }
From source file:org.mwc.debrief.track_shift.views.StackedDotHelper.java
/** * ok, our track has been dragged, calculate the new series of offsets * /*from ww w .j a va2 s . c o m*/ * @param linePlot * @param dotPlot * @param onlyVis * @param showCourse * @param b * @param holder * @param logger * * @param currentOffset * how far the current track has been dragged */ public void updateBearingData(final XYPlot dotPlot, final XYPlot linePlot, final TrackDataProvider tracks, final boolean onlyVis, final boolean showCourse, final boolean flipAxes, final Composite holder, final ErrorLogger logger, final boolean updateDoublets) { // do we even have a primary track if (_primaryTrack == null) return; // ok, find the track wrappers if (_secondaryTrack == null) initialise(tracks, false, onlyVis, holder, logger, "Bearing", true, false); // did it work? // if (_secondaryTrack == null) // return; // ok - the tracks have moved. better update the doublets if (updateDoublets) updateDoublets(onlyVis, true, false); // aah - but what if we've ditched our doublets? if ((_primaryDoublets == null) || (_primaryDoublets.size() == 0)) { // better clear the plot dotPlot.setDataset(null); linePlot.setDataset(null); return; } // create the collection of series final TimeSeriesCollection errorSeries = new TimeSeriesCollection(); final TimeSeriesCollection actualSeries = new TimeSeriesCollection(); // produce a dataset for each track final TimeSeries errorValues = new TimeSeries(_primaryTrack.getName()); final TimeSeries measuredValues = new TimeSeries("Measured"); final TimeSeries ambigValues = new TimeSeries("Ambiguous Bearing"); final TimeSeries calculatedValues = new TimeSeries("Calculated"); final TimeSeries osCourseValues = new TimeSeries("Course"); // ok, run through the points on the primary track final Iterator<Doublet> iter = _primaryDoublets.iterator(); while (iter.hasNext()) { final Doublet thisD = iter.next(); try { // obvious stuff first (stuff that doesn't need the tgt data) final Color thisColor = thisD.getColor(); double measuredBearing = thisD.getMeasuredBearing(); double ambigBearing = thisD.getAmbiguousMeasuredBearing(); final HiResDate currentTime = thisD.getDTG(); final FixedMillisecond thisMilli = new FixedMillisecond(currentTime.getDate().getTime()); // put the measured bearing back in the positive domain if (measuredBearing < 0) measuredBearing += 360d; // stop, stop, stop - do we wish to plot bearings in the +/- 180 domain? if (flipAxes) if (measuredBearing > 180) measuredBearing -= 360; final ColouredDataItem mBearing = new ColouredDataItem(thisMilli, measuredBearing, thisColor, false, null); // and add them to the series measuredValues.add(mBearing); if (ambigBearing != Doublet.INVALID_BASE_FREQUENCY) { if (flipAxes) if (ambigBearing > 180) ambigBearing -= 360; final ColouredDataItem amBearing = new ColouredDataItem(thisMilli, ambigBearing, thisColor, false, null); ambigValues.add(amBearing); } // do we have target data? if (thisD.getTarget() != null) { double calculatedBearing = thisD.getCalculatedBearing(null, null); final Color calcColor = thisD.getTarget().getColor(); final double thisError = thisD.calculateBearingError(measuredBearing, calculatedBearing); final ColouredDataItem newError = new ColouredDataItem(thisMilli, thisError, thisColor, false, null); if (flipAxes) if (calculatedBearing > 180) calculatedBearing -= 360; final ColouredDataItem cBearing = new ColouredDataItem(thisMilli, calculatedBearing, calcColor, true, null); errorValues.add(newError); calculatedValues.add(cBearing); } } catch (final SeriesException e) { CorePlugin.logError(Status.INFO, "some kind of trip whilst updating bearing plot", e); } } // right, we do course in a special way, since it isn't dependent on the // target track. Do course here. HiResDate startDTG, endDTG; // just double-check we've still got our primary doublets if (_primaryDoublets == null) { CorePlugin.logError(Status.WARNING, "FOR SOME REASON PRIMARY DOUBLETS IS NULL - INVESTIGATE", null); return; } if (_primaryDoublets.size() == 0) { CorePlugin.logError(Status.WARNING, "FOR SOME REASON PRIMARY DOUBLETS IS ZERO LENGTH - INVESTIGATE", null); return; } startDTG = _primaryDoublets.first().getDTG(); endDTG = _primaryDoublets.last().getDTG(); if (startDTG.greaterThan(endDTG)) { System.err.println("in the wrong order, start:" + startDTG + " end:" + endDTG); return; } final Collection<Editable> hostFixes = _primaryTrack.getItemsBetween(startDTG, endDTG); // loop through th items for (final Iterator<Editable> iterator = hostFixes.iterator(); iterator.hasNext();) { final Editable editable = (Editable) iterator.next(); final FixWrapper fw = (FixWrapper) editable; final FixedMillisecond thisMilli = new FixedMillisecond(fw.getDateTimeGroup().getDate().getTime()); double ownshipCourse = MWC.Algorithms.Conversions.Rads2Degs(fw.getCourse()); // stop, stop, stop - do we wish to plot bearings in the +/- 180 domain? if (flipAxes) if (ownshipCourse > 180) ownshipCourse -= 360; final ColouredDataItem crseBearing = new ColouredDataItem(thisMilli, ownshipCourse, fw.getColor(), true, null); osCourseValues.add(crseBearing); } // ok, add these new series if (showCourse) { actualSeries.addSeries(osCourseValues); } if (errorValues.getItemCount() > 0) errorSeries.addSeries(errorValues); actualSeries.addSeries(measuredValues); if (ambigValues.getItemCount() > 0) actualSeries.addSeries(ambigValues); if (calculatedValues.getItemCount() > 0) actualSeries.addSeries(calculatedValues); dotPlot.setDataset(errorSeries); linePlot.setDataset(actualSeries); }
From source file:com.att.aro.ui.view.diagnostictab.plot.AttenuatorPlot.java
/** * @param plot// ww w . ja v a 2 s. co m * @param seriesDL * @param seriesUP */ private void setDataPlot(XYPlot plot, XYSeries seriesDL, XYSeries seriesUP) { XYSeriesCollection sercollection = new XYSeriesCollection(); sercollection.addSeries(seriesDL); sercollection.addSeries(seriesUP); XYStepRenderer renderer = new XYStepRenderer(); XYPlot plot1 = (XYPlot) plot; plot1.getRangeAxis().setAutoRangeMinimumSize(2.0);//for the data set is constant value(ex. 0) renderer = (XYStepRenderer) plot1.getRenderer(); renderer.setBaseShapesVisible(true); renderer.setSeriesStroke(0, new BasicStroke(2.0f)); renderer.setSeriesStroke(1, new BasicStroke(4.0f)); renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); renderer.setDefaultEntityRadius(6); renderer.setBaseToolTipGenerator(new XYToolTipGenerator() { @Override public String generateToolTip(XYDataset dataset, int series, int item) { StringBuffer displayInfo = new StringBuffer(); java.lang.Number tempx = dataset.getX(series, item); java.lang.Number tempy = dataset.getY(series, item); // series 0 -> downstream , stries 1 -> upstream String streamInfo = ""; if (series == 0) { streamInfo = "Downlink Delay"; } else { streamInfo = "Uplink Delay"; } return displayInfo.append("Time: " + tempx + " , " + streamInfo + " : " + tempy + "ms").toString(); } }); plot.setRenderer(renderer); plot.setDataset(sercollection); }
From source file:com.att.aro.ui.view.diagnostictab.plot.UserEventPlot.java
@Override public void populate(XYPlot plot, AROTraceData analysis) { if (analysis != null) { userInputData.removeAllSeries(); // create the dataset... Map<UserEvent.UserEventType, XYIntervalSeries> seriesMap = new EnumMap<UserEvent.UserEventType, XYIntervalSeries>( UserEvent.UserEventType.class); for (UserEvent.UserEventType eventType : UserEvent.UserEventType.values()) { XYIntervalSeries series = new XYIntervalSeries(eventType); seriesMap.put(eventType, series); userInputData.addSeries(series); }/*from w w w .ja va 2 s.c om*/ // Populate the data set //need to add something here for (UserEvent event : analysis.getAnalyzerResult().getTraceresult().getUserEvents()) { seriesMap.get(event.getEventType()).add(event.getPressTime(), event.getPressTime(), event.getReleaseTime(), 0.5, 0, 1); } // Assign ToolTip to renderer XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(userInputData.indexOf(UserEventType.SCREEN_LANDSCAPE), Color.BLUE); renderer.setSeriesPaint(userInputData.indexOf(UserEventType.SCREEN_PORTRAIT), Color.BLUE); renderer.setBaseToolTipGenerator(new XYToolTipGenerator() { @Override public String generateToolTip(XYDataset dataset, int series, int item) { UserEvent.UserEventType eventType = (UserEvent.UserEventType) userInputData.getSeries(series) .getKey(); return ResourceBundleHelper.getEnumString(eventType); } }); } plot.setDataset(userInputData); // return plot; }
From source file:com.att.aro.ui.view.diagnostictab.plot.TemperaturePlot.java
@Override public void populate(XYPlot plot, AROTraceData analysis) { XYSeries series = new XYSeries(0); if (analysis == null) { logger.info("analysis data is null"); } else {//from w w w .j a v a 2s. co m TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType(); if (resultType.equals(TraceResultType.TRACE_FILE)) { logger.info("didn't get analysis trace data!"); } else { TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult() .getTraceresult(); AnalysisFilter filter = analysis.getAnalyzerResult().getFilter(); temperatureInfos = traceresult.getTemperatureInfos(); if (temperatureInfos.size() > 0) { for (TemperatureEvent bi : temperatureInfos) { series.add(bi.getTimeRecorded(), bi.getcelciusTemperature()); } TemperatureEvent last = temperatureInfos.get(temperatureInfos.size() - 1); if (filter.getTimeRange() != null) { series.add(filter.getTimeRange().getEndTime(), last.getcelciusTemperature()); } else { series.add(traceresult.getTraceDuration(), last.getcelciusTemperature()); } } XYItemRenderer renderer = plot.getRenderer(); renderer.setBaseToolTipGenerator(new XYToolTipGenerator() { @Override public String generateToolTip(XYDataset dataset, int series, int item) { return toolTipContent(item); } }); } plot.setDataset(new XYSeriesCollection(series)); } }