Help...
Help...
I'm trying to make a chart with “time spent on phone by month”. I’m doing some work with voip phones, and I wanted a chart were the administration could see how much time a user spend on the phone on a period of a couple of month’s.
The time data is in seconds and I would like to be on the chart in the format “HH:MM:SS”, this would be the left axis. The bottom axis is easy and it’s done, a DateAxis in the MMM-YY format. I would like it to be a line chart.
The left axis its harder… and I’m really don’t know how to do it. What DataSet to use? What left axis to use?
Could you please help me?
The time data is in seconds and I would like to be on the chart in the format “HH:MM:SS”, this would be the left axis. The bottom axis is easy and it’s done, a DateAxis in the MMM-YY format. I would like it to be a line chart.
The left axis its harder… and I’m really don’t know how to do it. What DataSet to use? What left axis to use?
Could you please help me?
-
- Posts: 15
- Joined: Mon Jun 26, 2006 8:31 pm
- Location: Paris
If you use a TimeSeriesChart with TimeSeriesCollection and if values of TimeSeries are in seconds, you can use a DateAxis for range axis :
Code: Select all
DateAxis dateAxisRange = new DateAxis("Time");
dateAxisRange.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss")) ;
xyplot.setRangeAxis(dateAxisRange );
Thanks for your solution.cenicienta wrote:If you use a TimeSeriesChart with TimeSeriesCollection and if values of TimeSeries are in seconds, you can use a DateAxis for range axis :Code: Select all
DateAxis dateAxisRange = new DateAxis("Time"); dateAxisRange.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss")) ; xyplot.setRangeAxis(dateAxisRange );
There is just something I don’t understand, in the dataSet I have to put the values in milliseconds, but when they are converted to Date it ads one hour. For example:
Code: Select all
TimeSeries s2 = new TimeSeries("total call time", Month.class);
s2.add(new Month(7, 2006), 1000);
TimeSeriesCollection dataset = new TimeSeriesCollection();
dataset.addSeries(s2);
Another problem is the autoRange. I would like it to rescale the axis to ensure that all data is visible, but I wanted 00:00:00 to appear in the axis also. I Tried to use setRange but I have to define the lower and the upper bound. I just want to define the lower bound and “autoRange” the upper bound.
Could anyone help me.
It sounds like there is an adjustment for daylight savings time taking place. You could test whether the timezone of the axis is currently observing daylight savings time to determine if you need to adjust the value.This dataSet should be displayed like 00:00:01 with the format “HH:mm:ss”, but its displayed 01:00:01. I don’t know why…. If I subtract a hour (-3600*1000) it is displayed correctly.
-
- Posts: 15
- Joined: Mon Jun 26, 2006 8:31 pm
- Location: Paris
What happens if you do that :
Code: Select all
DateAxis dateAxis = new DateAxis() ;
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
timeFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
dateAxis.setDateFormatOverride(timeFormat) ;
xyplot.setRangeAxis(dateAxis);
tks
Tks, that works, for the time problem.
Another problem is the autoRange. I would like it to rescale the axis to ensure that all data is visible, but I wanted 00:00:00 to appear in the axis also. I Tried to use setRange but I have to define the lower and the upper bound. I just want to define the lower bound and “autoRange” the upper bound.
If anyone can help, tks...
Another problem is the autoRange. I would like it to rescale the axis to ensure that all data is visible, but I wanted 00:00:00 to appear in the axis also. I Tried to use setRange but I have to define the lower and the upper bound. I just want to define the lower bound and “autoRange” the upper bound.
If anyone can help, tks...