问题
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);
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?

回答1:
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"));
The same can be done to format the Range axis (y-axis).
回答2:
Here i used the following code works good.
TimeSeries series1 = new TimeSeries("Random Data", Minute.class);
series1.add(new Minute(mi,hr,dat,mo,yr), value );
回答3:
In the DateAxis constructor, you will find this piece of code that constructs the set of "standard" tick sizes for a DateAxis:
DateAxis.createStandardDateTickUnits(zone, locale)
When rendering the axis, JFreeChart will choose the smallest tick size that doesn't cause the labels to overlap. At any time you can change the set of standard sizes that JFreeChart chooses from, just call setStandardTickUnits(...) and supply your own set.
Or, you can switch off the automatic tick unit selection and just set a fixed tick size using the setDateTickUnit() method, but now it is your responsibility to choose a tick size that doesn't result in overlapping labels.
回答4:
Actually i use the folloeing code to solve my problem. that is,
DateFormat formatter = new SimpleDateFormat("hh:mm:ss a");
DateAxis axis = (DateAxis) Plot.getDomainAxis();
axis.setDateFormatOverride(formatter);
It displays time like 01:15:45AM
来源:https://stackoverflow.com/questions/21253757/how-to-omit-fraction-in-seconds-at-jfreechart