如何在JFreeChart上以秒为单位忽略分数? [英] How to omit fraction in seconds at JFreeChart?

查看:42
本文介绍了如何在JFreeChart上以秒为单位忽略分数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,Atlast我只是为从数据库中收集的值生成JFreeChart.但是在那上面,我只是使用

Friends, Atlast i just generate JFreeChart for the collected value from the database. But on that, i just use

Second sec = new Second();
Series.add(sec.previous(), ExistingValue);
Series.add(sec, Value);
Dataset = new TimeSeriesCollection(Series);

但是它显示的结果包含另外的分数.它仅以0.250秒递增.实际上,我只希望秒数增加1.我该如何获取?还有从0以外的给定值开始Y角度图的任何方法吗?

But it displayed result contains additional fractional point. And it just incremented with 0.250 seconds. Actually i want seconds only incremented with 1. How can i get it? And Is there any way to start Y angle chart from given value other than 0?

推荐答案

您可以获取对绘图/图表的域"轴(x轴)的引用,并可以设置任何您喜欢的格式的SimpleDateFormat:

You can get a reference to the Domain axis (x-axis) of your plot/chart and set a SimpleDateFormat of any format you like:

JFreeChart chart;
DateAxis axis  = (DateAxis)chart.getXYPlot().getDomainAxis();
axis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss"));

可以执行同样的操作来格式化范围轴(y轴).

The same can be done to format the Range axis (y-axis).

这篇关于如何在JFreeChart上以秒为单位忽略分数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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