本文整理汇总了Java中org.jfree.data.time.TimeSeriesCollection.addSeries方法的典型用法代码示例。如果您正苦于以下问题:Java TimeSeriesCollection.addSeries方法的具体用法?Java TimeSeriesCollection.addSeries怎么用?Java TimeSeriesCollection.addSeries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.time.TimeSeriesCollection
的用法示例。
在下文中一共展示了TimeSeriesCollection.addSeries方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSerialization4
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
/**
* Serialize a time seroes chart, restore it, and check for equality.
*/
@Test
public void testSerialization4() {
RegularTimePeriod t = new Day();
TimeSeries series = new TimeSeries("Series 1");
series.add(t, 36.4);
t = t.next();
series.add(t, 63.5);
TimeSeriesCollection dataset = new TimeSeriesCollection();
dataset.addSeries(series);
JFreeChart c1 = ChartFactory.createTimeSeriesChart("Test", "Date",
"Value", dataset);
JFreeChart c2 = (JFreeChart) TestUtilities.serialised(c1);
assertEquals(c1, c2);
}
示例2: createDataset
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
private XYDataset createDataset(List<String> industrys) {
TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
if (industrys != null) {
for (String industry : industrys) {
TimeSeries timeseries = new TimeSeries(industry + "资金统计",
org.jfree.data.time.Day.class);
List<IndustryInfo> industryInfos = industryInfoDao.get(industry);
Double value = 0.0;
if (industryInfos != null) {
for (IndustryInfo industryInfo : industryInfos) {
value = value + industryInfo.getTotal() / 10000;
timeseries.add(new Day(DateUtil.parse(String.valueOf(industryInfo.getDate()), DateUtil.DATE_FORMAT_DAY_SHORT)), value);
}
}
timeseriescollection.addSeries(timeseries);
}
}
return timeseriescollection;
}
示例3: createDataset
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
private XYDataset createDataset(List<String> industrys) {
TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
if (industrys != null) {
for (String industry : industrys) {
TimeSeries timeseries = new TimeSeries(industry + "涨跌统计",
org.jfree.data.time.Day.class);
List<IndustryInfo> industryInfos = industryInfoDao.get(industry);
BigDecimal value = new BigDecimal(0);
if (industryInfos != null) {
for (IndustryInfo industryInfo : industryInfos) {
if (industryInfo.getRise() != null) {
value = value.add(industryInfo.getRise());
}
timeseries.add(new Day(DateUtil.parse(String.valueOf(industryInfo.getDate()), DateUtil.DATE_FORMAT_DAY_SHORT)), value);
}
}
timeseriescollection.addSeries(timeseries);
}
}
return timeseriescollection;
}
示例4: 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);
}
示例5: createDataset
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
/**
* Creates a sample dataset.
*
* @param name the dataset name.
* @param base the starting value.
* @param start the starting period.
* @param count the number of values to generate.
*
* @return The dataset.
*/
private static XYDataset createDataset(String name, double base,
RegularTimePeriod start, int count) {
TimeSeries series = new TimeSeries(name, start.getClass());
RegularTimePeriod period = start;
double value = base;
for (int i = 0; i < count; i++) {
series.add(period, value);
period = period.next();
value = value * (1 + (Math.random() - 0.495) / 10.0);
}
TimeSeriesCollection dataset = new TimeSeriesCollection();
dataset.addSeries(series);
return dataset;
}
示例6: 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);
}
示例7: createDataset
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
/**
* Creates a sample dataset.
*
* @param name the dataset name.
* @param base the starting value.
* @param start the starting period.
* @param count the number of values to generate.
*
* @return The dataset.
*/
private static XYDataset createDataset(String name, double base,
RegularTimePeriod start, int count) {
TimeSeries series = new TimeSeries(name);
RegularTimePeriod period = start;
double value = base;
for (int i = 0; i < count; i++) {
series.add(period, value);
period = period.next();
value = value * (1 + (Math.random() - 0.495) / 10.0);
}
TimeSeriesCollection dataset = new TimeSeriesCollection();
dataset.addSeries(series);
return dataset;
}
示例8: testSerialization4
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
/**
* Serialize a time seroes chart, restore it, and check for equality.
*/
@Test
public void testSerialization4() {
RegularTimePeriod t = new Day();
TimeSeries series = new TimeSeries("Series 1");
series.add(t, 36.4);
t = t.next();
series.add(t, 63.5);
TimeSeriesCollection dataset = new TimeSeriesCollection();
dataset.addSeries(series);
JFreeChart c1 = ChartFactory.createTimeSeriesChart("Test", "Date",
"Value", dataset);
JFreeChart c2 = (JFreeChart) TestUtils.serialised(c1);
assertEquals(c1, c2);
}
示例9: createDataset
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
/**
* Creates the dataset.
*
* @return the XY dataset
*/
private XYDataset createDataset() {
TimeSeriesCollection dataset = new TimeSeriesCollection();
TimeSeries s1 = new TimeSeries(this.values1_des);
for(int i = 0; i < this.values1.length; i++) {
s1.add(new Day(dates.get(i)), this.values1[i]);
}
dataset.addSeries(s1);
if(this.values2 != null) {
TimeSeries s2 = new TimeSeries(this.values2_des);
for(int i = 0; i < this.values2.length; i++) {
s2.add(new Day(dates.get(i)), this.values2[i]);
}
dataset.addSeries(s2);
}
return dataset;
}
示例10: createTimeSeries
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
/**
* Returns data with series 0 = current and 1 = baseline. This method assumes there is exactly one
* metric in the response data.
*/
private TimeSeriesCollection createTimeSeries(final TimeOnTimeComparisonResponse data) {
final TimeSeries baseline = new TimeSeries(BASELINE_LABEL);
final TimeSeries current = new TimeSeries(CURRENT_LABEL);
for (int i = 0; i < data.getNumRows(); i++) {
Row row = data.getRow(i);
// Plot the baseline data as an overlay on the corresponding current data point.
// long baselineStart = row.getBaselineStart().getMillis();
long currentStart = row.getCurrentStart().getMillis();
Date date = new Date(currentStart);
RegularTimePeriod timePeriod = new Millisecond(date);
Metric metric = row.getMetrics().get(0);
baseline.add(timePeriod, metric.getBaselineValue());
current.add(timePeriod, metric.getCurrentValue());
}
final TimeSeriesCollection dataset = new TimeSeriesCollection();
dataset.addSeries(current);
dataset.addSeries(baseline);
return dataset;
}
示例11: AttitudeChart
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
/**
* Create a new instance of this chart.
*/
public AttitudeChart() {
this.yawSeries = new TimeSeries("Yaw", "Degree", "Time");
this.pitchSeries = new TimeSeries("Pitch", "Degree", "Time");
this.rollSeries = new TimeSeries("Roll", "Degree", "Time");
yawSeries.setMaximumItemCount(1000);
pitchSeries.setMaximumItemCount(1000);
rollSeries.setMaximumItemCount(1000);
dataset = new TimeSeriesCollection();
dataset.addSeries(this.yawSeries);
dataset.addSeries(this.pitchSeries);
dataset.addSeries(this.rollSeries);
createChart("Time", "Degree", "Yaw / Pitch / Roll", true);
}
示例12: AttitudeChart
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
/**
* yeni bir grafik �rne�ini olu�turun.
*/
public AttitudeChart()
{
this.yawSeries = new TimeSeries("Yaw", "Derece", "Zaman");
this.pitchSeries = new TimeSeries("Pitch", "Derece", "Zaman");
this.rollSeries = new TimeSeries("Roll", "Derece", "Zaman");
yawSeries.setMaximumItemCount(500);
pitchSeries.setMaximumItemCount(500);
rollSeries.setMaximumItemCount(500);
dataset = new TimeSeriesCollection();
dataset.addSeries(this.yawSeries);
dataset.addSeries(this.pitchSeries);
dataset.addSeries(this.rollSeries);
createChart("Zaman", "Derece", "Yaw / Pitch / Roll", true);
}
示例13: 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());
}
示例14: 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));
}
示例15: createDataset
import org.jfree.data.time.TimeSeriesCollection; //导入方法依赖的package包/类
private XYDataset createDataset(TimeSeries timeseries[], TimeSeries timeSeriesSensibilidad[]){
TimeSeriesCollection dataset = new TimeSeriesCollection();
dataset.setDomainIsPointsInTime(true);
for(int i = 0; i < timeseries.length;i++){
timeseries[i] = new TimeSeries("Path" + (i+1), Second.class);
//path1.add(new Second(0, 0, 0, 7, 12, 2011), 0.0);
dataset.addSeries(timeseries[i]);
}
for(int i = 0; i < timeSeriesSensibilidad.length;i++){
timeSeriesSensibilidad[i] = new TimeSeries("Sensibilidad Rx", Second.class);
//path1.add(new Second(0, 0, 0, 7, 12, 2011), 0.0);
dataset.addSeries(timeSeriesSensibilidad[i]);
}
/*
fecha = new Date();
timeSeriesSensibilidad.addOrUpdate(new Second(fecha.getSeconds(), fecha.getMinutes(), fecha.getHours(),
fecha.getDate(), fecha.getMonth()+1, 2012), -80);
*/
return dataset;
}