本文整理汇总了Java中org.jfree.data.xy.DefaultTableXYDataset.addSeries方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultTableXYDataset.addSeries方法的具体用法?Java DefaultTableXYDataset.addSeries怎么用?Java DefaultTableXYDataset.addSeries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.xy.DefaultTableXYDataset
的用法示例。
在下文中一共展示了DefaultTableXYDataset.addSeries方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEquals
import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
final DefaultTableXYDataset d1 = new DefaultTableXYDataset();
final XYSeries s1 = new XYSeries("Series 1", true, false);
s1.add(1.0, 1.1);
s1.add(2.0, 2.2);
d1.addSeries(s1);
final DefaultTableXYDataset d2 = new DefaultTableXYDataset();
final XYSeries s2 = new XYSeries("Series 1", true, false);
s2.add(1.0, 1.1);
s2.add(2.0, 2.2);
d2.addSeries(s2);
assertTrue(d1.equals(d2));
assertTrue(d2.equals(d1));
s1.add(3.0, 3.3);
assertFalse(d1.equals(d2));
s2.add(3.0, 3.3);
assertTrue(d1.equals(d2));
}
示例2: testAutoPrune
import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
/**
* Tests the auto-pruning feature.
*/
public void testAutoPrune() {
// WITH AUTOPRUNING
DefaultTableXYDataset dataset = new DefaultTableXYDataset(true);
dataset.addSeries(createSeriesA());
assertEquals(2, dataset.getItemCount()); // should be 2 items
dataset.addSeries(createSeriesB());
assertEquals(2, dataset.getItemCount()); // still 2
dataset.removeSeries(1);
assertEquals(1, dataset.getItemCount()); // 1 value pruned.
// WITHOUT AUTOPRUNING
DefaultTableXYDataset dataset2 = new DefaultTableXYDataset(true);
dataset2.addSeries(createSeriesA());
assertEquals(2, dataset2.getItemCount()); // should be 2 items
dataset2.addSeries(createSeriesB());
assertEquals(2, dataset2.getItemCount()); // still 2
dataset2.removeSeries(1);
assertEquals(1, dataset2.getItemCount()); // still 2.
}
示例3: createTableXYDataset1
import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
/**
* Creates a sample dataset for testing purposes.
*
* @return A sample dataset.
*/
private TableXYDataset createTableXYDataset1() {
DefaultTableXYDataset dataset = new DefaultTableXYDataset();
XYSeries s1 = new XYSeries("Series 1", true, false);
s1.add(1.0, 1.0);
s1.add(2.0, 2.0);
dataset.addSeries(s1);
XYSeries s2 = new XYSeries("Series 2", true, false);
s2.add(1.0, -2.0);
s2.add(2.0, -1.0);
dataset.addSeries(s2);
return dataset;
}
示例4: testEquals
import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
DefaultTableXYDataset d1 = new DefaultTableXYDataset();
XYSeries s1 = new XYSeries("Series 1", true, false);
s1.add(1.0, 1.1);
s1.add(2.0, 2.2);
d1.addSeries(s1);
DefaultTableXYDataset d2 = new DefaultTableXYDataset();
XYSeries s2 = new XYSeries("Series 1", true, false);
s2.add(1.0, 1.1);
s2.add(2.0, 2.2);
d2.addSeries(s2);
assertTrue(d1.equals(d2));
assertTrue(d2.equals(d1));
s1.add(3.0, 3.3);
assertFalse(d1.equals(d2));
s2.add(3.0, 3.3);
assertTrue(d1.equals(d2));
}
示例5: createTableXYDataset1
import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
/**
* Creates a sample dataset for testing purposes.
*
* @return A sample dataset.
*/
private TableXYDataset createTableXYDataset1() {
DefaultTableXYDataset dataset = new DefaultTableXYDataset();
XYSeries s1 = new XYSeries("Series 1", true, false);
s1.add(1.0, 1.0);
s1.add(2.0, 2.0);
dataset.addSeries(s1);
XYSeries s2 = new XYSeries("Series 2", true, false);
s2.add(1.0, -2.0);
s2.add(2.0, -1.0);
dataset.addSeries(s2);
return dataset;
}
示例6: generateIndividualSeries
import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
/**
* Generate the individual series for the specified key.
*
* @param key the key identifying which result to plot
* @param dataset the dataset to store the generated series
*/
protected void generateIndividualSeries(ResultKey key,
DefaultTableXYDataset dataset) {
for (Accumulator accumulator : controller.get(key)) {
if (!accumulator.keySet().contains(metric)) {
continue;
}
XYSeries series = new XYSeries(key, false, false);
for (int i=0; i<accumulator.size(metric); i++) {
series.add((Number)accumulator.get("NFE", i),
(Number)accumulator.get(metric, i));
}
dataset.addSeries(series);
}
}
示例7: series2DataSet
import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
/**
* Initialize a series for a port or IP graph with all the values set to zero and
* add it to the database and to the hashmap containing all the series.
*
* @param dataset
* @param series
* @param renderer
* @param roundedStart
* @param name
* @param requestParams
*/
private void series2DataSet(DefaultTableXYDataset dataset,
Map<DataPoint, float[]> series, XYItemRenderer renderer,
long roundedStart, String name, RequestParams requestParams, int resolution)
{
// Put the series into the graph
for (DataPoint seriesId : series.keySet())
{
XYSeries xySeries = new XYSeries(seriesId.getSeriesId() + name,
true, false);
float[] values = series.get(seriesId);
long j = 0;
for (float val : values)
{
xySeries.add(Long.valueOf(roundedStart + j * resolution), Float
.valueOf(val));
j++;
}
dataset.addSeries(xySeries);
renderer.setSeriesPaint(dataset.getSeriesCount() - 1,
seriesId.getSeriesColor());
}
}
示例8: createDataset
import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
/**
* Creates a sample dataset.
*
* @return a sample dataset.
*/
protected TableXYDataset createDataset(boolean isDemo) {
if (isDemo){
DefaultTableXYDataset dataset = new DefaultTableXYDataset();
XYSeries s1 = new XYSeries("Series 1", true, false);
s1.add(5.0, 5.0);
s1.add(10.0, 15.5);
s1.add(15.0, 9.5);
s1.add(20.0, 7.5);
dataset.addSeries(s1);
XYSeries s2 = new XYSeries("Series 2", true, false);
s2.add(5.0, 5.0);
s2.add(10.0, 15.5);
s2.add(15.0, 9.5);
s2.add(20.0, 3.5);
dataset.addSeries(s2);
return dataset;}
else return super.createDataset(false);
}
示例9: populate
import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
@Override
public void populate(DefaultTableXYDataset dataset, StatsCollection statsCollection,
HttpServletRequest request) {
String seriesParam = ServletRequestUtils.getStringParameter(request, "sp", null);
for (int i = 0; i < statNames.size(); i++) {
String statName = statNames.get(i);
if (seriesParam != null) {
statName = MessageFormat.format(statName, seriesParam);
}
List<XYDataItem> stats = statsCollection.getStats(statName);
if (stats != null) {
String series =
ServletRequestUtils.getStringParameter(request, "s" + (i + 1) + "l", "series" + i);
dataset.addSeries(toSeries(series, stats));
}
}
}
示例10: populate
import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
@Override
public void populate(DefaultTableXYDataset dataset, StatsCollection statsCollection,
HttpServletRequest request) {
// get Connector name from the request
String connectorName = ServletRequestUtils.getStringParameter(request, "cn", null);
// type of statistic to be displayed
String statType = ServletRequestUtils.getStringParameter(request, "st", null);
// Series legend
String series1Legend = ServletRequestUtils.getStringParameter(request, "sl", "");
if (connectorName != null && statType != null) {
List<XYDataItem> stats =
statsCollection.getStats("stat.connector." + connectorName + "." + statType);
if (stats != null) {
dataset.addSeries(toSeries(series1Legend, stats));
}
}
}
示例11: addSeries
import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
public void addSeries(String name, double[] data, Paint linePaint){
DefaultTableXYDataset dataset = (DefaultTableXYDataset)chart.getXYPlot().getDataset(0);
XYSeries series = new XYSeries(name, false, false);
if(data != null){
for(int j = 0; j < data.length; j++){
series.add(new Integer(j), new Double(data[j]));
}
seriesLengths.put(name, data.length);
}
else
seriesLengths.put(name, 0);
dataset.addSeries(series);
seriesIds.put(name, new Integer(seriesCount));
chart.getXYPlot().getRenderer().setSeriesPaint(seriesCount, linePaint);
seriesCount++;
// Set renerer
}
示例12: populate
import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
public void populate(DefaultTableXYDataset dataset, StatsCollection statsCollection, HttpServletRequest request) {
//
// get Connector name from the request
//
String connectorName = ServletRequestUtils.getStringParameter(request, "cn", null);
//
// type of statistic to be displayed
//
String statType = ServletRequestUtils.getStringParameter(request, "st", null);
//
// Series legend
//
String series1Legend = ServletRequestUtils.getStringParameter(request, "sl", "");
if (connectorName != null && statType != null) {
List l = statsCollection.getStats("stat.connector." + connectorName + "." + statType);
if (l != null) {
dataset.addSeries(toSeries(series1Legend, l));
}
}
}
示例13: testTableXYDataset
import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
/**
* Assorted tests.
*/
public void testTableXYDataset() {
XYSeries series1 = createSeries1();
XYSeries series2 = createSeries2();
DefaultTableXYDataset dataset = new DefaultTableXYDataset();
dataset.addSeries(series1);
dataset.addSeries(series2);
// Test that there are 6 X points and some specific values
assertEquals(6, dataset.getItemCount());
assertEquals(6, dataset.getX(0, 5).intValue());
assertEquals(null, dataset.getY(0, 5));
assertEquals(6, dataset.getX(1, 5).intValue());
assertEquals(2, dataset.getY(1, 5).intValue());
// after adding a point to a series, check that there are now 7
// items in each series
series2.add(7, 2);
assertEquals(7, dataset.getItemCount());
assertEquals(null, dataset.getY(0, 6));
assertEquals(2, dataset.getY(1, 6).intValue());
// Remove series 1
dataset.removeSeries(series1);
// Test that there are still 7 X points
assertEquals(7, dataset.getItemCount());
// Remove series 2 and add new series
dataset.removeSeries(series2);
series1 = createSeries1();
dataset.addSeries(series1);
// Test that there are now 4 X points
assertEquals(4, dataset.getItemCount());
}
示例14: testEquals
import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
final DefaultTableXYDataset d1 = new DefaultTableXYDataset();
final DefaultTableXYDataset d2 = new DefaultTableXYDataset();
assertTrue(d1.equals(d2));
assertTrue(d2.equals(d1));
d1.addSeries(createSeries1());
assertFalse(d1.equals(d2));
d2.addSeries(createSeries1());
assertTrue(d1.equals(d2));
}
示例15: getTableXYData
import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
@Override
protected TableXYDataset getTableXYData() {
final DefaultTableXYDataset retVal = new DefaultTableXYDataset();
for (final Object tmpXYSeries : myCollection.getSeries()) {
retVal.addSeries((XYSeries) tmpXYSeries);
}
return retVal;
}