PDA

View Full Version : [OPEN] [FIXED-EXTJSIV-150]A couple of chart suggestions...



James Goddard
17 Feb 2011, 12:25 PM
These aren't necessarily bugs but at least one is really easy to implement and would greatly extend functionality.

1. The Time axis (BTW, why is it axes in the code?) doesn't actually support time. It only supports date. The reason is that there are no groupBy methods for anything less than 'day'. A simple fix of adding 'hour', 'minute', etc would allow you to graph things below a single day's values. For example, we do charts of data for the last 24 hours.

2. It would be nice to support non-values, similar to the way RRD does it. For example, if I have a time series that looks like this:

time: AAA, value: 5
time: BBB, value: 6
time: CCC
time: DDD, value: 4
time: EEE, value: 6

This would draw two distinct lines on the graph with a hole or blank area in between them. As it stands the graph draws a line from the BBB value of 6 to 0 at CCC and another line from 0 at CCC to the DDD value of 4.

Jamie Avins
18 Feb 2011, 4:41 PM
Sounds like good idea to me, we'll work on them.

Animal
19 Feb 2011, 10:43 AM
Yes allowing "missing" values in a series not to be interpreted as zero can be quite important. When you are dealing with data gathered remotely, or in real time, values may be missed due to transitory errors. I have hit this issue.

Allan
18 Mar 2011, 12:50 PM
Hi,

Add:



,
'hour': function(date) {
return date.getHours();
},
'minute': function(date) {
return date.getMinutes();
},
'second': function(date) {
return date.getSeconds();
}


to Time.js around line 125 or line 48123 in ext-all-debug.js (PR4) to solve issue #1.

margozzi
18 Mar 2011, 1:40 PM
I tried that using hour, min, sec and it didn't work. Are the names important? Also, what do you think the correct Time axis config would look like? I ran into problems as the code wants to do aggregation even though i don't need/want it to.

Allan
18 Mar 2011, 2:36 PM
yes, the names must match the ones you use in the groupBy option

So I used

[/CODE]
dateMethods: {
'year': function(date) {
return date.getFullYear();
},
'day': function(date) {
return date.getDate();
},
'month': function(date) {
return date.getMonth() + 1;
},
'hour': function(date) {
return date.getHours();
},
'minute': function(date) {
return date.getMinutes();
},
'second': function(date) {
return date.getSeconds();
}
}
[/CODE]

which means I can group by "hour,second" if need be.

margozzi
18 Mar 2011, 2:44 PM
My chart comes up with no data and no error messages in the console :-(
here is my Axis config for the Time:

{
type: 'Time',
position: 'bottom',
fields: ['T'],
groupBy: 'hour,second',
title: false,
dateFormat: 'g:i:s',
step: [Ext.Date.SECOND, 1],
}
See anything obviously wrong?

Allan
18 Mar 2011, 6:55 PM
Unfortunately I don't see anything wrong!

James Goddard
21 Mar 2011, 3:35 AM
Actually as of pr4 (and 5) I haven't been able to get a time axis to render at all. I think maybe it's being reworked.

philogb
22 Mar 2011, 9:08 AM
Hi,

Thanks for the feedback. I just pushed a change in which the Time Axis handles now (built-in) Date objects as opposed to formatted-string dates and now can handle hours, minutes, seconds and milliseconds.

I also added a fix to handle gaps in the lines.

An example of an axis configuration for dealing with seconds is:




{
type: 'Time',
position: 'bottom',
fields: 'date',
title: 'Seconds',
dateFormat: 'M d Y H i s',
groupBy: 'year,month,day,hour,minute,second',
aggregateOp: 'sum',

constrain: true,
fromDate: new Date('1/1/11'),
toDate: myDate,
step: [Ext.Date.SECOND, 1]
},



I hope this helps,

Allan
22 Mar 2011, 7:06 PM
How would we handle x axes that may have ANY time resolution whatsoever, could I count time in femtoseconds?

Have you looked at http://www.highcharts.com/ref/#xAxis ? That is excellent documentation, btw.

James Goddard
23 Mar 2011, 4:53 AM
Thanks for the feedback. I just pushed a change in which the Time Axis handles now (built-in) Date objects as opposed to formatted-string dates and now can handle hours, minutes, seconds and milliseconds.

I also added a fix to handle gaps in the lines.


This is excellent news. Thanks for the updates, I look forward to trying them. I have a question. Correct me if I'm wrong but it appears from the doc and the code that the Time axis actually controls the data point being shown. I.E. if I groupBy '...,hour' then the data will be aggregated to no more than 1 point per hour? Or do these settings only effect the axis itself? For example, I want to be able to show all the data points in my store, but only show axis markers every hour.

James Goddard
23 Mar 2011, 5:02 AM
How would we handle x axes that may have ANY time resolution whatsoever, could I count time in femtoseconds?

Probably would have to use a category chart since the JavaScript Date object doesn't support femtoseconds.

Allan
23 Mar 2011, 5:09 AM
Probably would have to use a category chart since the JavaScript Date object doesn't support femtoseconds.

Hmm, I guess this is a charting package and not a plotting package, I had hoped for both really.

margozzi
23 Mar 2011, 3:53 PM
Great, I will rty it when the next PR comes out. Can you possibly comment on the aggregationOp? I did not see an option for "none" and I think when I read the code, you always do a bunch of work to compute some aggregate. What if I want to chart multiple lines but don't need/want any aggregation? Should there not be a "no op" or "none" or if the aggregationOp were null it means don't do one?

margozzi
31 Mar 2011, 9:47 AM
I am not having any luck with the new axis. have you tried this with remote data? Some aggregation code is failing because the data has not been retrieved yet. Also, you never answered my question about have no aggregation operation. Or at least explain what the aggregation is doing? As of this moment, I am unable to use the time axis ( still ).

James Goddard
5 Apr 2011, 5:03 AM
I also added a fix to handle gaps in the lines.


I have been unsuccessful getting a gap to show up where data is missing. Can you give an example of how to make this work?

James Goddard
6 Apr 2011, 9:44 AM
I have been unsuccessful getting a gap to show up where data is missing. Can you give an example of how to make this work?

I looked at the source and got this to work. Seems the source is only set to handle this if the value is set to false (strictly typed). I was able to get the gaps to show up by defining a new data type that set the value to false if the data was not there.

I've run into another issue with this now, however. When I set some of the values to false, I do get the gaps, but I also do not get any markers?

James Goddard
7 Apr 2011, 8:02 AM
[QUOTE=James Goddard;588305
I've run into another issue with this now, however. When I set some of the values to false, I do get the gaps, but I also do not get any markers?[/QUOTE]

If it helps, it appears that the missing markers are in the markup but have the class "x-hide-visibility".

margozzi
7 Apr 2011, 1:04 PM
I wonder if they are reading here any more since the title has:
[FIXED-EXTJSIV-150] (http://www.sencha.com/forum/showthread.php?124355-FIXED-EXTJSIV-150-A-couple-of-chart-suggestions...&p=588735)

James Goddard
8 Apr 2011, 9:43 AM
I wonder if they are reading here any more since the title has:
[FIXED-EXTJSIV-150] (http://www.sencha.com/forum/showthread.php?124355-FIXED-EXTJSIV-150-A-couple-of-chart-suggestions...&p=588735)

I would hope that they included regression testing as part of their process and that would be the difference between FIXED and CLOSED.

steffenk
8 Apr 2011, 9:48 AM
pushing here might be the way to get the needed attention ;)