本文整理汇总了Java中org.jfree.data.time.TimeSeriesCollection.removeSeries方法的典型用法代码示例。如果您正苦于以下问题:Java TimeSeriesCollection.removeSeries方法的具体用法?Java TimeSeriesCollection.removeSeries怎么用?Java TimeSeriesCollection.removeSeries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.time.TimeSeriesCollection
的用法示例。
在下文中一共展示了TimeSeriesCollection.removeSeries方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRemoveSeries
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
/**
* Tests the remove series method.
*/
public void testRemoveSeries() {
final TimeSeriesCollection c1 = new TimeSeriesCollection();
final TimeSeries s1 = new TimeSeries("Series 1");
final TimeSeries s2 = new TimeSeries("Series 2");
final TimeSeries s3 = new TimeSeries("Series 3");
final TimeSeries s4 = new TimeSeries("Series 4");
c1.addSeries(s1);
c1.addSeries(s2);
c1.addSeries(s3);
c1.addSeries(s4);
c1.removeSeries(s3);
final TimeSeries s = c1.getSeries(2);
final boolean b1 = s.equals(s4);
assertTrue(b1);
}
示例2: testRemoveSeries
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
/**
* Tests the remove series method.
*/
public void testRemoveSeries() {
TimeSeriesCollection c1 = new TimeSeriesCollection();
TimeSeries s1 = new TimeSeries("Series 1");
TimeSeries s2 = new TimeSeries("Series 2");
TimeSeries s3 = new TimeSeries("Series 3");
TimeSeries s4 = new TimeSeries("Series 4");
c1.addSeries(s1);
c1.addSeries(s2);
c1.addSeries(s3);
c1.addSeries(s4);
c1.removeSeries(s3);
TimeSeries s = c1.getSeries(2);
boolean b1 = s.equals(s4);
assertTrue(b1);
}
示例3: removeSeries
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
/** Remove a data series */
public void removeSeries(String name){
TimeSeriesCollection dataset = (TimeSeriesCollection)chart.getXYPlot().getDataset(0);
int id = ((Integer)seriesIds.get(name)).intValue();
dataset.removeSeries(id);
// Decrament all ids greater than id
for(Enumeration i = seriesIds.keys(); i.hasMoreElements();){
String k = (String)i.nextElement();
int tmpId = seriesIds.get(k);
if(tmpId > id){
tmpId--;
seriesIds.put(k, tmpId);
chart.getXYPlot().getRenderer().setSeriesPaint(tmpId, seriesPaint.get(k));
}
}
seriesCount--;
}
示例4: testRemoveSeries_int
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
/**
* Some checks for the {@link TimeSeriesCollection#removeSeries(int)}
* method.
*/
public void testRemoveSeries_int() {
TimeSeriesCollection c1 = new TimeSeriesCollection();
TimeSeries s1 = new TimeSeries("Series 1");
TimeSeries s2 = new TimeSeries("Series 2");
TimeSeries s3 = new TimeSeries("Series 3");
TimeSeries s4 = new TimeSeries("Series 4");
c1.addSeries(s1);
c1.addSeries(s2);
c1.addSeries(s3);
c1.addSeries(s4);
c1.removeSeries(2);
assertTrue(c1.getSeries(2).equals(s4));
c1.removeSeries(0);
assertTrue(c1.getSeries(0).equals(s2));
assertEquals(2, c1.getSeriesCount());
}
示例5: testIndexOf
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
/**
* Some tests for the indexOf() method.
*/
public void testIndexOf() {
TimeSeries s1 = new TimeSeries("S1");
TimeSeries s2 = new TimeSeries("S2");
TimeSeriesCollection dataset = new TimeSeriesCollection();
assertEquals(-1, dataset.indexOf(s1));
assertEquals(-1, dataset.indexOf(s2));
dataset.addSeries(s1);
assertEquals(0, dataset.indexOf(s1));
assertEquals(-1, dataset.indexOf(s2));
dataset.addSeries(s2);
assertEquals(0, dataset.indexOf(s1));
assertEquals(1, dataset.indexOf(s2));
dataset.removeSeries(s1);
assertEquals(-1, dataset.indexOf(s1));
assertEquals(0, dataset.indexOf(s2));
TimeSeries s2b = new TimeSeries("S2");
assertEquals(0, dataset.indexOf(s2b));
}
示例6: testEquals
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
/**
* Some tests for the equals() method.
*/
public void testEquals() {
final TimeSeriesCollection c1 = new TimeSeriesCollection();
final TimeSeriesCollection c2 = new TimeSeriesCollection();
final TimeSeries s1 = new TimeSeries("Series 1");
final TimeSeries s2 = new TimeSeries("Series 2");
// newly created collections should be equal
final boolean b1 = c1.equals(c2);
assertTrue("b1", b1);
// add series to collection 1, should be not equal
c1.addSeries(s1);
c1.addSeries(s2);
final boolean b2 = c1.equals(c2);
assertFalse("b2", b2);
// now add the same series to collection 2 to make them equal again...
c2.addSeries(s1);
c2.addSeries(s2);
final boolean b3 = c1.equals(c2);
assertTrue("b3", b3);
// now remove series 2 from collection 2
c2.removeSeries(s2);
final boolean b4 = c1.equals(c2);
assertFalse("b4", b4);
// now remove series 2 from collection 1 to make them equal again
c1.removeSeries(s2);
final boolean b5 = c1.equals(c2);
assertTrue("b5", b5);
}
示例7: testEquals
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
/**
* Some tests for the equals() method.
*/
public void testEquals() {
TimeSeriesCollection c1 = new TimeSeriesCollection();
TimeSeriesCollection c2 = new TimeSeriesCollection();
TimeSeries s1 = new TimeSeries("Series 1");
TimeSeries s2 = new TimeSeries("Series 2");
// newly created collections should be equal
boolean b1 = c1.equals(c2);
assertTrue("b1", b1);
// add series to collection 1, should be not equal
c1.addSeries(s1);
c1.addSeries(s2);
boolean b2 = c1.equals(c2);
assertFalse("b2", b2);
// now add the same series to collection 2 to make them equal again...
c2.addSeries(s1);
c2.addSeries(s2);
boolean b3 = c1.equals(c2);
assertTrue("b3", b3);
// now remove series 2 from collection 2
c2.removeSeries(s2);
boolean b4 = c1.equals(c2);
assertFalse("b4", b4);
// now remove series 2 from collection 1 to make them equal again
c1.removeSeries(s2);
boolean b5 = c1.equals(c2);
assertTrue("b5", b5);
}
示例8: removeSeries
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
protected void removeSeries(JFreeChart chart, int seriesIndex) {
Color color = (Color) chart.getPlot().getLegendItems().get(seriesIndex).getLinePaint();
palette.release(color);
String key = enabled.remove(seriesIndex);
XYPlot plot = chart.getXYPlot();
Series<?> series = sampler.getSeries(key);
Unit unit = series.getUnit();
Integer datasetIndex = datasetMapping.get(unit);
TimeSeriesCollection col = (TimeSeriesCollection) plot.getDataset(datasetIndex);
List<String> colIndices = seriesMapping.get(unit);
int colIndex = colIndices.indexOf(key);
colIndices.remove(key);
col.removeSeries(colIndex);
if (col.getSeriesCount() == 0) {
plot.setDataset(datasetIndex, null);
plot.setRangeAxis(datasetIndex, null);
seriesMapping.remove(unit);
datasetMapping.remove(unit);
}
rebuildLegend();
repaint();
gp.saveLayout();
}
示例9: maintain
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
public void maintain() {
dataSource.update();
TimeSeriesCollection collection = (TimeSeriesCollection) chart.getXYPlot().getDataset();
collection.removeSeries(1);
collection.addSeries(createAverageSeries(dataSource.getTimeSeries()));
}