JFreeChart TimeSeries图表删除没有值的天数 [英] JFreeChart TimeSeries Chart remove days with no value

查看:188
本文介绍了JFreeChart TimeSeries图表删除没有值的天数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一个简单的方法来删除没有价值的天?
以下是我的一些数据

12-04-2012 => 15

13-04-2012 => 12

15-04-2012 => 10

16-04-2012 => 5

Is there a simple way to remove days with no value? Here is some of my data
12-04-2012 => 15
13-04-2012 => 12
15-04-2012 => 10
16-04-2012 => 5

在图表14-04-2012画了。我的意思是,theres在13-04和15-04之间更长的线。

In chart 14-04-2012 is painted. I mean, theres a longer line between 13-04 and 15-04. Is it possible to have equal gaps between values?

推荐答案

是否使用TimeSeries(org.jfree.data.time.TimeSeries
)?如果这样考虑使用CategoryDataset(org.jfree.data.time.TimeSeries)

Are you using an TimeSeries (org.jfree.data.time.TimeSeries )? if so consider using a CategoryDataset (org.jfree.data.time.TimeSeries)

   private static CategoryDataset createDataset() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(15, "Series 1", "12-04-2012");
    dataset.addValue(12, "Series 1", "13-04-2012");
    dataset.addValue(10, "Series 1", "15-04-2012");
    dataset.addValue(5,  "Series 1",  "16-04-2012");
    return dataset;
} 

使用此数据与JFreeChart 线图演示8 您会看到:

Using this data with JFreeChart Line Chart Demo 8 you will get this:

省略第14个

这篇关于JFreeChart TimeSeries图表删除没有值的天数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆