当前位置: 首页>>代码示例>>Java>>正文


Java XYSeries.setKey方法代码示例

本文整理汇总了Java中org.jfree.data.xy.XYSeries.setKey方法的典型用法代码示例。如果您正苦于以下问题:Java XYSeries.setKey方法的具体用法?Java XYSeries.setKey怎么用?Java XYSeries.setKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.data.xy.XYSeries的用法示例。


在下文中一共展示了XYSeries.setKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testEquals

import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    
    XYSeries s1 = new XYSeries("Series");
    s1.add(1.0, 1.1);
    XYSeries s2 = new XYSeries("Series");
    s2.add(1.0, 1.1);
    assertTrue(s1.equals(s2));
    assertTrue(s2.equals(s1));

    s1.setKey("Series X");
    assertFalse(s1.equals(s2));

    s2.setKey("Series X");
    assertTrue(s1.equals(s2));

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:XYSeriesTests.java

示例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);
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:45,代码来源:XyChartModel.java

示例3: setSeriesLabel

import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
@Override
public void setSeriesLabel(int seriesIndex, String newLabel) {
	XYSeries series = this.getSeries(seriesIndex);
	if(series != null){
		series.setKey(newLabel);
	}
	
	this.setChanged();
	this.notifyObservers(ChartModel.EventType.SERIES_RENAMED);
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:11,代码来源:XyChartModel.java


注:本文中的org.jfree.data.xy.XYSeries.setKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。