本文整理汇总了Java中org.jfree.data.xy.XYIntervalSeriesCollection.addSeries方法的典型用法代码示例。如果您正苦于以下问题:Java XYIntervalSeriesCollection.addSeries方法的具体用法?Java XYIntervalSeriesCollection.addSeries怎么用?Java XYIntervalSeriesCollection.addSeries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.xy.XYIntervalSeriesCollection
的用法示例。
在下文中一共展示了XYIntervalSeriesCollection.addSeries方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEquals
import org.jfree.data.xy.XYIntervalSeriesCollection; //导入方法依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
XYIntervalSeriesCollection c1 = new XYIntervalSeriesCollection();
XYIntervalSeriesCollection c2 = new XYIntervalSeriesCollection();
assertEquals(c1, c2);
// add a series
XYIntervalSeries s1 = new XYIntervalSeries("Series");
s1.add(1.0, 1.1, 1.2, 1.3, 1.4, 1.5);
c1.addSeries(s1);
assertFalse(c1.equals(c2));
XYIntervalSeries s2 = new XYIntervalSeries("Series");
s2.add(1.0, 1.1, 1.2, 1.3, 1.4, 1.5);
c2.addSeries(s2);
assertTrue(c1.equals(c2));
// add an empty series
c1.addSeries(new XYIntervalSeries("Empty Series"));
assertFalse(c1.equals(c2));
c2.addSeries(new XYIntervalSeries("Empty Series"));
assertTrue(c1.equals(c2));
}
示例2: testFindDomainBounds2
import org.jfree.data.xy.XYIntervalSeriesCollection; //导入方法依赖的package包/类
/**
* A test for the findDomainBounds method to ensure it correctly accounts
* for the series visibility.
*/
@Test
public void testFindDomainBounds2() {
XYIntervalSeries s1 = new XYIntervalSeries("S1");
s1.add(1.0, 0.5, 1.5, 10.0, 9.5, 10.5);
s1.add(2.0, 1.9, 2.1, 20.0, 19.8, 20.3);
XYIntervalSeries s2 = new XYIntervalSeries("S2");
s2.add(3.0, 2.5, 3.5, 30.0, 29.5, 30.5);
s2.add(4.0, 3.9, 4.1, 9.0, 9.0, 9.0);
XYIntervalSeriesCollection dataset = new XYIntervalSeriesCollection();
dataset.addSeries(s1);
dataset.addSeries(s2);
XYBarRenderer renderer = new XYBarRenderer();
Range r = renderer.findDomainBounds(dataset);
assertEquals(0.5, r.getLowerBound(), EPSILON);
assertEquals(4.1, r.getUpperBound(), EPSILON);
renderer.setSeriesVisible(1, Boolean.FALSE);
r = renderer.findDomainBounds(dataset);
assertEquals(0.5, r.getLowerBound(), EPSILON);
assertEquals(2.1, r.getUpperBound(), EPSILON);
}
示例3: testFindRangeBounds2
import org.jfree.data.xy.XYIntervalSeriesCollection; //导入方法依赖的package包/类
/**
* A test for the findRangeBounds method to ensure it correctly accounts
* for the series visibility.
*/
@Test
public void testFindRangeBounds2() {
XYIntervalSeries s1 = new XYIntervalSeries("S1");
s1.add(1.0, 0.5, 1.5, 10.0, 9.5, 10.5);
s1.add(2.0, 1.9, 2.1, 20.0, 19.8, 20.3);
XYIntervalSeries s2 = new XYIntervalSeries("S2");
s2.add(3.0, 2.5, 3.5, 30.0, 29.5, 30.5);
s2.add(4.0, 3.9, 4.1, 9.0, 9.0, 9.0);
XYIntervalSeriesCollection dataset = new XYIntervalSeriesCollection();
dataset.addSeries(s1);
dataset.addSeries(s2);
XYBarRenderer renderer = new XYBarRenderer();
renderer.setUseYInterval(false);
Range r = renderer.findRangeBounds(dataset);
assertEquals(9.0, r.getLowerBound(), EPSILON);
assertEquals(30.0, r.getUpperBound(), EPSILON);
renderer.setSeriesVisible(1, Boolean.FALSE);
r = renderer.findRangeBounds(dataset);
assertEquals(10.0, r.getLowerBound(), EPSILON);
assertEquals(20.0, r.getUpperBound(), EPSILON);
}
示例4: testBug2849731_2
import org.jfree.data.xy.XYIntervalSeriesCollection; //导入方法依赖的package包/类
/**
* Another test for bug 2849731.
*/
@Test
public void testBug2849731_2() {
XYIntervalSeriesCollection d = new XYIntervalSeriesCollection();
XYIntervalSeries s = new XYIntervalSeries("S1");
s.add(1.0, Double.NaN, Double.NaN, Double.NaN, 1.5, Double.NaN);
d.addSeries(s);
Range r = DatasetUtilities.iterateDomainBounds(d);
assertEquals(1.0, r.getLowerBound(), EPSILON);
assertEquals(1.0, r.getUpperBound(), EPSILON);
s.add(1.0, 1.5, Double.NaN, Double.NaN, 1.5, Double.NaN);
r = DatasetUtilities.iterateDomainBounds(d);
assertEquals(1.0, r.getLowerBound(), EPSILON);
assertEquals(1.5, r.getUpperBound(), EPSILON);
s.add(1.0, Double.NaN, 0.5, Double.NaN, 1.5, Double.NaN);
r = DatasetUtilities.iterateDomainBounds(d);
assertEquals(0.5, r.getLowerBound(), EPSILON);
assertEquals(1.5, r.getUpperBound(), EPSILON);
}
示例5: testBug2849731_3
import org.jfree.data.xy.XYIntervalSeriesCollection; //导入方法依赖的package包/类
/**
* Yet another test for bug 2849731.
*/
@Test
public void testBug2849731_3() {
XYIntervalSeriesCollection d = new XYIntervalSeriesCollection();
XYIntervalSeries s = new XYIntervalSeries("S1");
s.add(1.0, Double.NaN, Double.NaN, 1.5, Double.NaN, Double.NaN);
d.addSeries(s);
Range r = DatasetUtilities.iterateRangeBounds(d);
assertEquals(1.5, r.getLowerBound(), EPSILON);
assertEquals(1.5, r.getUpperBound(), EPSILON);
s.add(1.0, 1.5, Double.NaN, Double.NaN, Double.NaN, 2.5);
r = DatasetUtilities.iterateRangeBounds(d);
assertEquals(1.5, r.getLowerBound(), EPSILON);
assertEquals(2.5, r.getUpperBound(), EPSILON);
s.add(1.0, Double.NaN, 0.5, Double.NaN, 3.5, Double.NaN);
r = DatasetUtilities.iterateRangeBounds(d);
assertEquals(1.5, r.getLowerBound(), EPSILON);
assertEquals(3.5, r.getUpperBound(), EPSILON);
}
示例6: testBug2849731_2
import org.jfree.data.xy.XYIntervalSeriesCollection; //导入方法依赖的package包/类
/**
* Another test for bug 2849731.
*/
@Test
public void testBug2849731_2() {
XYIntervalSeriesCollection d = new XYIntervalSeriesCollection();
XYIntervalSeries s = new XYIntervalSeries("S1");
s.add(1.0, Double.NaN, Double.NaN, Double.NaN, 1.5, Double.NaN);
d.addSeries(s);
Range r = DatasetUtils.iterateDomainBounds(d);
assertEquals(1.0, r.getLowerBound(), EPSILON);
assertEquals(1.0, r.getUpperBound(), EPSILON);
s.add(1.0, 1.5, Double.NaN, Double.NaN, 1.5, Double.NaN);
r = DatasetUtils.iterateDomainBounds(d);
assertEquals(1.0, r.getLowerBound(), EPSILON);
assertEquals(1.5, r.getUpperBound(), EPSILON);
s.add(1.0, Double.NaN, 0.5, Double.NaN, 1.5, Double.NaN);
r = DatasetUtils.iterateDomainBounds(d);
assertEquals(0.5, r.getLowerBound(), EPSILON);
assertEquals(1.5, r.getUpperBound(), EPSILON);
}
示例7: testBug2849731_3
import org.jfree.data.xy.XYIntervalSeriesCollection; //导入方法依赖的package包/类
/**
* Yet another test for bug 2849731.
*/
@Test
public void testBug2849731_3() {
XYIntervalSeriesCollection d = new XYIntervalSeriesCollection();
XYIntervalSeries s = new XYIntervalSeries("S1");
s.add(1.0, Double.NaN, Double.NaN, 1.5, Double.NaN, Double.NaN);
d.addSeries(s);
Range r = DatasetUtils.iterateRangeBounds(d);
assertEquals(1.5, r.getLowerBound(), EPSILON);
assertEquals(1.5, r.getUpperBound(), EPSILON);
s.add(1.0, 1.5, Double.NaN, Double.NaN, Double.NaN, 2.5);
r = DatasetUtils.iterateRangeBounds(d);
assertEquals(1.5, r.getLowerBound(), EPSILON);
assertEquals(2.5, r.getUpperBound(), EPSILON);
s.add(1.0, Double.NaN, 0.5, Double.NaN, 3.5, Double.NaN);
r = DatasetUtils.iterateRangeBounds(d);
assertEquals(1.5, r.getLowerBound(), EPSILON);
assertEquals(3.5, r.getUpperBound(), EPSILON);
}
示例8: testBug2849731_2
import org.jfree.data.xy.XYIntervalSeriesCollection; //导入方法依赖的package包/类
/**
* Another test for bug 2849731.
*/
public void testBug2849731_2() {
XYIntervalSeriesCollection d = new XYIntervalSeriesCollection();
XYIntervalSeries s = new XYIntervalSeries("S1");
s.add(1.0, Double.NaN, Double.NaN, Double.NaN, 1.5, Double.NaN);
d.addSeries(s);
Range r = DatasetUtilities.iterateDomainBounds(d);
assertEquals(1.0, r.getLowerBound(), EPSILON);
assertEquals(1.0, r.getUpperBound(), EPSILON);
s.add(1.0, 1.5, Double.NaN, Double.NaN, 1.5, Double.NaN);
r = DatasetUtilities.iterateDomainBounds(d);
assertEquals(1.0, r.getLowerBound(), EPSILON);
assertEquals(1.5, r.getUpperBound(), EPSILON);
s.add(1.0, Double.NaN, 0.5, Double.NaN, 1.5, Double.NaN);
r = DatasetUtilities.iterateDomainBounds(d);
assertEquals(0.5, r.getLowerBound(), EPSILON);
assertEquals(1.5, r.getUpperBound(), EPSILON);
}
示例9: testBug2849731_3
import org.jfree.data.xy.XYIntervalSeriesCollection; //导入方法依赖的package包/类
/**
* Yet another test for bug 2849731.
*/
public void testBug2849731_3() {
XYIntervalSeriesCollection d = new XYIntervalSeriesCollection();
XYIntervalSeries s = new XYIntervalSeries("S1");
s.add(1.0, Double.NaN, Double.NaN, 1.5, Double.NaN, Double.NaN);
d.addSeries(s);
Range r = DatasetUtilities.iterateRangeBounds(d);
assertEquals(1.5, r.getLowerBound(), EPSILON);
assertEquals(1.5, r.getUpperBound(), EPSILON);
s.add(1.0, 1.5, Double.NaN, Double.NaN, Double.NaN, 2.5);
r = DatasetUtilities.iterateRangeBounds(d);
assertEquals(1.5, r.getLowerBound(), EPSILON);
assertEquals(2.5, r.getUpperBound(), EPSILON);
s.add(1.0, Double.NaN, 0.5, Double.NaN, 3.5, Double.NaN);
r = DatasetUtilities.iterateRangeBounds(d);
assertEquals(1.5, r.getLowerBound(), EPSILON);
assertEquals(3.5, r.getUpperBound(), EPSILON);
}
示例10: testEquals
import org.jfree.data.xy.XYIntervalSeriesCollection; //导入方法依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
XYIntervalSeriesCollection c1 = new XYIntervalSeriesCollection();
XYIntervalSeriesCollection c2 = new XYIntervalSeriesCollection();
assertEquals(c1, c2);
// add a series
XYIntervalSeries s1 = new XYIntervalSeries("Series");
s1.add(1.0, 1.1, 1.2, 1.3, 1.4, 1.5);
c1.addSeries(s1);
assertFalse(c1.equals(c2));
XYIntervalSeries s2 = new XYIntervalSeries("Series");
s2.add(1.0, 1.1, 1.2, 1.3, 1.4, 1.5);
c2.addSeries(s2);
assertTrue(c1.equals(c2));
// add an empty series
c1.addSeries(new XYIntervalSeries("Empty Series"));
assertFalse(c1.equals(c2));
c2.addSeries(new XYIntervalSeries("Empty Series"));
assertTrue(c1.equals(c2));
}
示例11: createNewSerie
import org.jfree.data.xy.XYIntervalSeriesCollection; //导入方法依赖的package包/类
@Override
protected void createNewSerie(final IScope scope, final String serieid) {
final ChartDataSeries dataserie = chartdataset.getDataSeries(scope, serieid);
final XYIntervalSeries serie = new XYIntervalSeries(dataserie.getSerieLegend(scope), false, true);
final XYPlot plot = (XYPlot) this.chart.getPlot();
final XYIntervalSeriesCollection firstdataset = (XYIntervalSeriesCollection) plot.getDataset();
if (!IdPosition.containsKey(serieid)) {
if (firstdataset.getSeriesCount() == 0) {
firstdataset.addSeries(serie);
plot.setDataset(0, firstdataset);
} else {
final XYIntervalSeriesCollection newdataset = new XYIntervalSeriesCollection();
newdataset.addSeries(serie);
jfreedataset.add(newdataset);
plot.setDataset(jfreedataset.size() - 1, newdataset);
}
plot.setRenderer(jfreedataset.size() - 1, (XYItemRenderer) getOrCreateRenderer(scope, serieid));
IdPosition.put(serieid, jfreedataset.size() - 1);
// System.out.println("new serie"+serieid+" at
// "+IdPosition.get(serieid)+" fdsize "+plot.getSeriesCount()+" jfds
// "+jfreedataset.size()+" datasc "+plot.getDatasetCount());
// TODO Auto-generated method stub
}
}
示例12: createEmptyData
import org.jfree.data.xy.XYIntervalSeriesCollection; //导入方法依赖的package包/类
@Override
public BookReporterChartData createEmptyData(final double signalLength, TagStyle tagStyle) {
return new BookReporterChartData(getThreshold(), tagStyle) {
private final LinkedList<Occurrence> occurrences = new LinkedList<Occurrence>();
@Override
protected void include(Collection<BookReporterAtom> filteredAtoms) {
for (BookReporterAtom atom : filteredAtoms) {
double time = atom.position / 3600.0;
double length = atom.scale * BookReporterConstants.TIME_OCCUPATION_SCALE / 1800.0;
occurrences.add(new Occurrence(time, atom.amplitude, length));
}
}
@Override
public XYPlot getPlot() {
XYIntervalSeries data = new XYIntervalSeries("amplitudes [µV]");
for (Occurrence o : occurrences) {
data.add(o.time, o.time-0.5*o.length, o.time+0.5*o.length, o.value, o.value, o.value);
}
NumberAxis yAxis = new NumberAxis(getWavesName());
XYIntervalSeriesCollection collection = new XYIntervalSeriesCollection();
collection.addSeries(data);
return new XYPlot(
collection,
new NumberAxis(), yAxis,
new XYBarRenderer()
);
}
};
}
示例13: createEmptyData
import org.jfree.data.xy.XYIntervalSeriesCollection; //导入方法依赖的package包/类
@Override
public BookReporterChartData createEmptyData(final double signalLength, TagStyle tagStyle) {
return new BookReporterChartData(getThreshold(), tagStyle) {
private final int timeInterval = getTimeInterval();
private final int[] counts = new int[ (int) Math.ceil(signalLength/timeInterval) ];
@Override
protected void include(Collection<BookReporterAtom> filteredAtoms) {
for (BookReporterAtom atom : filteredAtoms) {
int interval_index = (int) Math.floor(atom.position / this.timeInterval);
if (interval_index>=0 && interval_index<this.counts.length) {
this.counts[interval_index]++;
}
}
}
@Override
public XYPlot getPlot() {
XYIntervalSeries data = new XYIntervalSeries("count per "+getTimeInterval()+" s");
for (int i=0; i<this.counts.length; i++) {
double secondsLeft = i * timeInterval;
double secondsCenter = (i+0.5) * timeInterval;
double secondsRight = (i+1) * timeInterval;
data.add(secondsCenter/3600.0, secondsLeft/3600.0, secondsRight/3600.0, counts[i], counts[i], counts[i]);
}
NumberAxis yAxis = new NumberAxis(getWavesName());
XYIntervalSeriesCollection collection = new XYIntervalSeriesCollection();
collection.addSeries(data);
return new XYPlot(
collection,
new NumberAxis(), yAxis,
new XYBarRenderer()
);
}
};
}
示例14: createEmptyData
import org.jfree.data.xy.XYIntervalSeriesCollection; //导入方法依赖的package包/类
@Override
public BookReporterChartData createEmptyData(final double signalLength, TagStyle tagStyle) {
final boolean showHorizLines = showHorizontalLines;
return new BookReporterChartData(getThreshold(), tagStyle) {
private final int timeInterval = getTimeInterval();
private final BookReporterTimeIntervalSet intervals = new BookReporterTimeIntervalSet();
@Override
protected void include(Collection<BookReporterAtom> filteredAtoms) {
for (BookReporterAtom atom : filteredAtoms) {
BookReporterTimeInterval newInterval = BookReporterTimeInterval.create(
atom.position - atom.scale * BookReporterConstants.TIME_OCCUPATION_SCALE,
atom.position + atom.scale * BookReporterConstants.TIME_OCCUPATION_SCALE
);
intervals.add(newInterval);
}
}
@Override
public XYPlot getPlot() {
XYIntervalSeries data = new XYIntervalSeries("% occupied in "+getTimeInterval()+" s");
int dataPointCount = (int) Math.ceil(signalLength/timeInterval);
for (int i=0; i<dataPointCount; i++) {
double secondsLeft = i * timeInterval;
double secondsCenter = (i+0.5) * timeInterval;
double secondsRight = (i+1) * timeInterval;
BookReporterTimeInterval interval = BookReporterTimeInterval.create(secondsLeft, secondsRight);
double percentage = 100.0 * intervals.cover(interval) / timeInterval;
data.add(secondsCenter/3600.0, secondsLeft/3600.0, secondsRight/3600.0, percentage, percentage, percentage);
}
NumberAxis yAxis = new NumberAxis(getWavesName());
XYIntervalSeriesCollection collection = new XYIntervalSeriesCollection();
collection.addSeries(data);
XYPlot plot = new XYPlot(
collection,
new NumberAxis(), yAxis,
new XYBarRenderer()
);
if (showHorizLines) {
plot.addRangeMarker(new ValueMarker(20.0));
plot.addRangeMarker(new ValueMarker(50.0));
}
return plot;
}
};
}