本文整理汇总了Java中org.jfree.data.xy.XYSeries.clear方法的典型用法代码示例。如果您正苦于以下问题:Java XYSeries.clear方法的具体用法?Java XYSeries.clear怎么用?Java XYSeries.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.xy.XYSeries
的用法示例。
在下文中一共展示了XYSeries.clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillToXYSeriesPriv
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
protected void fillToXYSeriesPriv(XYSeries series, float[] spectrum){
series.clear();
/**
* caching decreases GC usage
*/
boolean useCached = false;
if (!useCached){
for (int i = 0; i < spectrum.length; i++)
{
double freq = (freqStartHz + fftBinSizeHz * i) / 1000000;
series.add(freq, spectrum[i]);
}
}
else{
ArrayList<XYDataItem> items = cachedDataItems.get(cachedDataItemsIndex);
for (int i = 0; i < spectrum.length; i++)
{
XYDataItem item = items.get(i);
item.setY(spectrum[i]);
series.add(item);
}
cachedDataItemsIndex = (cachedDataItemsIndex+1)%cachedDataItems.size();
}
}
示例2: exchangeSeries
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
@Override
public void exchangeSeries(int seriesIndex, DataSeries series) throws NoSuchSeriesException {
if(seriesIndex < this.getSeriesCount()){
XyDataSeries xyDataSeries = (XyDataSeries) series;
XYSeries editSeries = this.getSeries(seriesIndex);
// --- Are there configuration changes ? --------------------------
if (xyDataSeries.getAutoSort()==editSeries.getAutoSort() && xyDataSeries.getAvoidDuplicateXValues()==(!editSeries.getAllowDuplicateXValues())) {
// --- No configuration changes -------------------------------
editSeries.clear();
if (series.getLabel()!=null) {
editSeries.setKey(series.getLabel());
}
List valuePairs = xyDataSeries.getXyValuePairs();
for (int i = 0; i < valuePairs.size(); i++) {
XyValuePair valuePair = (XyValuePair) valuePairs.get(i);
editSeries.add(valuePair.getXValue().getFloatValue(), valuePair.getYValue().getFloatValue());
}
} else {
// --- Configuration has changed ------------------------------
XYSeries newSeries = (XYSeries) this.getXYSeriesFromXyDataSeries(xyDataSeries);
// --- Replace the edit series with the new series ------------
Vector<XYSeries> currSerieses = new Vector<XYSeries>();
for (int i=0; i < this.getSeriesCount(); i++) {
currSerieses.add(this.getSeries(i));
}
currSerieses.set(seriesIndex, newSeries);
this.getXySeriesCollection().removeAllSeries();
for (int i = 0; i < currSerieses.size(); i++) {
this.getXySeriesCollection().addSeries(currSerieses.get(i));
}
}
}else{
throw new NoSuchSeriesException();
}
this.setChanged();
this.notifyObservers(ChartModel.EventType.SERIES_ADDED);
}
示例3: clear
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
public void clear()
{
XYSeries.clear();
}