本文整理汇总了Java中org.jfree.data.xy.XYSeries.addOrUpdate方法的典型用法代码示例。如果您正苦于以下问题:Java XYSeries.addOrUpdate方法的具体用法?Java XYSeries.addOrUpdate怎么用?Java XYSeries.addOrUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.xy.XYSeries
的用法示例。
在下文中一共展示了XYSeries.addOrUpdate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAddOrUpdate
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
/**
* Some checks for the addOrUpdate() method.
*/
public void testAddOrUpdate() {
XYSeries series = new XYSeries("S1");
XYDataItem old = series.addOrUpdate(new Long(1), new Long(2));
assertTrue(old == null);
assertEquals(1, series.getItemCount());
assertEquals(new Long(2), series.getY(0));
old = series.addOrUpdate(new Long(2), new Long(3));
assertTrue(old == null);
assertEquals(2, series.getItemCount());
assertEquals(new Long(3), series.getY(1));
old = series.addOrUpdate(new Long(1), new Long(99));
assertEquals(new XYDataItem(new Long(1), new Long(2)), old);
assertEquals(2, series.getItemCount());
assertEquals(new Long(99), series.getY(0));
assertEquals(new Long(3), series.getY(1));
}
示例2: testAddOrUpdate2
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
/**
* Some checks for the addOrUpdate() method for an UNSORTED series.
*/
public void testAddOrUpdate2() {
XYSeries series = new XYSeries("Series", false, true);
series.add(5.0, 5.5);
series.add(6.0, 6.6);
series.add(3.0, 3.3);
series.add(4.0, 4.4);
series.add(2.0, 2.2);
series.add(1.0, 1.1);
series.addOrUpdate(new Double(3.0), new Double(33.3));
series.addOrUpdate(new Double(2.0), new Double(22.2));
assertEquals(33.3, series.getY(2).doubleValue(), EPSILON);
assertEquals(22.2, series.getY(4).doubleValue(), EPSILON);
}