• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DefaultTableXYDataset类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jfree.data.xy.DefaultTableXYDataset的典型用法代码示例。如果您正苦于以下问题:Java DefaultTableXYDataset类的具体用法?Java DefaultTableXYDataset怎么用?Java DefaultTableXYDataset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DefaultTableXYDataset类属于org.jfree.data.xy包,在下文中一共展示了DefaultTableXYDataset类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:DefaultTableXYDatasetTests.java


示例2: testAutoPrune

import org.jfree.data.xy.DefaultTableXYDataset; //导入依赖的package包/类
/**
 * Tests the auto-pruning feature.
 */
public void testAutoPrune() {
    
    // WITH AUTOPRUNING
    final 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
    final 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.
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:TableXYDatasetTests.java


示例3: testDrawWithEmptyDataset

import org.jfree.data.xy.DefaultTableXYDataset; //导入依赖的package包/类
/**
 * Test chart drawing with an empty dataset to ensure that this special
 * case doesn't cause any exceptions.
 */
public void testDrawWithEmptyDataset() {
    boolean success = false;
    JFreeChart chart = ChartFactory.createStackedXYAreaChart("title", "x",
            "y", new DefaultTableXYDataset(), PlotOrientation.VERTICAL,
            true, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(new StackedXYAreaRenderer2());
    try {
        BufferedImage image = new BufferedImage(200 , 100, 
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
        g2.dispose();
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:StackedXYAreaRenderer2Tests.java


示例4: testFindRangeBounds

import org.jfree.data.xy.DefaultTableXYDataset; //导入依赖的package包/类
/**
 * Check that the renderer is calculating the range bounds correctly.
 */
public void testFindRangeBounds() {
    TableXYDataset dataset 
            = RendererXYPackageTests.createTestTableXYDataset();
    JFreeChart chart = ChartFactory.createStackedXYAreaChart(
            "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL, 
            false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2();
    plot.setRenderer(renderer);
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    Range bounds = rangeAxis.getRange();
    assertTrue(bounds.contains(6.0));
    assertTrue(bounds.contains(8.0));
    
    // try null argument
    assertNull(renderer.findRangeBounds(null));
    
    // try empty dataset
    assertNull(renderer.findRangeBounds(new DefaultTableXYDataset()));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:StackedXYAreaRenderer2Tests.java


示例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;  
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:DatasetUtilitiesTests.java


示例6: 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));

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:DefaultTableXYDatasetTests.java


示例7: 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.
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:TableXYDatasetTests.java


示例8: testDrawWithEmptyDataset

import org.jfree.data.xy.DefaultTableXYDataset; //导入依赖的package包/类
/**
 * Test chart drawing with an empty dataset to ensure that this special
 * case doesn't cause any exceptions.
 */
@Test
public void testDrawWithEmptyDataset() {
    boolean success = false;
    JFreeChart chart = ChartFactory.createStackedXYAreaChart("title", "x",
            "y", new DefaultTableXYDataset(), PlotOrientation.VERTICAL,
            true, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(new StackedXYAreaRenderer2());
    try {
        BufferedImage image = new BufferedImage(200 , 100,
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
        g2.dispose();
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:26,代码来源:StackedXYAreaRenderer2Test.java


示例9: testFindRangeBounds

import org.jfree.data.xy.DefaultTableXYDataset; //导入依赖的package包/类
/**
 * Check that the renderer is calculating the range bounds correctly.
 */
@Test
public void testFindRangeBounds() {
    TableXYDataset dataset
            = RendererXYPackageUtils.createTestTableXYDataset();
    JFreeChart chart = ChartFactory.createStackedXYAreaChart(
            "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL,
            false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2();
    plot.setRenderer(renderer);
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    Range bounds = rangeAxis.getRange();
    assertTrue(bounds.contains(6.0));
    assertTrue(bounds.contains(8.0));

    // try null argument
    assertNull(renderer.findRangeBounds(null));

    // try empty dataset
    assertNull(renderer.findRangeBounds(new DefaultTableXYDataset()));
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:25,代码来源:StackedXYAreaRenderer2Test.java


示例10: 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;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:21,代码来源:DatasetUtilitiesTest.java


示例11: 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);
	}
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:24,代码来源:LinePlot.java


示例12: 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());
	}
}
 
开发者ID:aptivate,项目名称:pmgraph,代码行数:35,代码来源:GraphFactory.java


示例13: 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);
      
  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:28,代码来源:StackedXYAreaChartDemo1.java


示例14: 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));
    }
  }
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:19,代码来源:StandardSeriesProvider.java


示例15: 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));
    }
  }
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:22,代码来源:ConnectorSeriesProvider.java


示例16: 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
}
 
开发者ID:Cride5,项目名称:jablus,代码行数:19,代码来源:AreaGraphPanel.java


示例17: createDataset

import org.jfree.data.xy.DefaultTableXYDataset; //导入依赖的package包/类
private static XYDataset createDataset(TrackPoint points[]) {
    DefaultTableXYDataset dataset = new DefaultTableXYDataset();
    XYSeries series = new XYSeries("Series 1", true, false);
    TrackPoint prev = null;
    double d = 0;
    for (TrackPoint pt: points) {
        if (prev != null) {
            d += EarthGeometry.distance(pt, prev);
        }
        double km = d/1000.0;
        if (series.indexOf(km) < 0) {
            series.add(km, pt.getH());
        }
        prev = pt;
    }
    dataset.addSeries(series);
    System.out.println("Distance: " + d);
    return dataset;
}
 
开发者ID:robbyn,项目名称:hiketools,代码行数:20,代码来源:Profile.java


示例18: testDrawWithEmptyDataset

import org.jfree.data.xy.DefaultTableXYDataset; //导入依赖的package包/类
/**
 * Test chart drawing with an empty dataset to ensure that this special
 * case doesn't cause any exceptions.
 */
public void testDrawWithEmptyDataset() {
    boolean success = false;
    JFreeChart chart = ChartFactory.createStackedXYAreaChart("title", "x",
            "y", new DefaultTableXYDataset(), true);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(new StackedXYAreaRenderer2());
    try {
        BufferedImage image = new BufferedImage(200 , 100,
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
        g2.dispose();
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:24,代码来源:StackedXYAreaRenderer2Tests.java


示例19: testFindRangeBounds

import org.jfree.data.xy.DefaultTableXYDataset; //导入依赖的package包/类
/**
 * Check that the renderer is calculating the range bounds correctly.
 */
public void testFindRangeBounds() {
    TableXYDataset dataset
            = RendererXYPackageTests.createTestTableXYDataset();
    JFreeChart chart = ChartFactory.createStackedXYAreaChart(
            "Test Chart", "X", "Y", dataset, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2();
    plot.setRenderer(renderer);
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    Range bounds = rangeAxis.getRange();
    assertTrue(bounds.contains(6.0));
    assertTrue(bounds.contains(8.0));

    // try null argument
    assertNull(renderer.findRangeBounds(null));

    // try empty dataset
    assertNull(renderer.findRangeBounds(new DefaultTableXYDataset()));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:23,代码来源:StackedXYAreaRenderer2Tests.java


示例20: 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));

}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:28,代码来源:DefaultTableXYDatasetTests.java



注:本文中的org.jfree.data.xy.DefaultTableXYDataset类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TabSet类代码示例发布时间:2022-05-21
下一篇:
Java Frequency类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap