use of org.jfree.data.xy.XYSeriesCollection in project openblocks by mikaelhg.
the class CLineGraph method clearValues.
/**
* Clear the graph starting from the startTime.
* @param startTime an x-value on the graph
*/
public void clearValues(int index, double startTime) {
if (!lock) {
XYSeries s = ((XYSeriesCollection) chart.getXYPlot().getDataset()).getSeries(index);
int i = s.indexOf(startTime);
if (i >= 0) {
int total = s.getItemCount();
for (; i < total; total--) {
s.remove(i);
}
}
}
}
use of org.jfree.data.xy.XYSeriesCollection in project openblocks by mikaelhg.
the class CLineGraph method updateValues.
/**
* Updates the values for the specified seriesName with the given values
* @param seriesName the name a series in the graph
* @param index the index of the desired series to update
* @param time the time at which to update
* @param value the value to update
*/
public void updateValues(String seriesName, int index, double time, double value) {
if (!lock) {
XYSeries s = ((XYSeriesCollection) chart.getXYPlot().getDataset()).getSeries(index);
s.setKey(seriesName);
s.addOrUpdate(time, value);
}
}
use of org.jfree.data.xy.XYSeriesCollection in project openblocks by mikaelhg.
the class CLineGraph method updateSeriesNameAt.
/**
* Updates the series name at the specified index
* @param seriesName the new seriesName to set at the specified index
* @param index the desired index to set the new seriesName to
*/
public void updateSeriesNameAt(String seriesName, int index) {
if (!lock) {
XYSeries s = ((XYSeriesCollection) chart.getXYPlot().getDataset()).getSeries(index);
s.setKey(seriesName);
}
}
Aggregations