#6812 closed enhancement (fixed)
support missing data point in line chart
Reported by: | guest | Owned by: | cjolif |
---|---|---|---|
Priority: | high | Milestone: | 1.8 |
Component: | Charting | Version: | 1.1.0 |
Keywords: | Cc: | cjolif | |
Blocked By: | Blocking: |
Description
current dojo charting doesn't support the display of missing data points. for example, if the series is [1,2,null, 4] or [1,2, ,4], the chart would generate very unintuitive results. In case of line chart, the chart should display a gap in the line if there's null or missing data point. I am not familiar enough with other types of charts to say what should be expected. At a minimum, this should be supported in line chart.
Current workaround is to split the series into 2 series and draw 2 seperate lines on the chart. However it's a paint to keep track of these broken arrays and broken lines.
Change History (17)
comment:1 Changed 13 years ago by
Component: | Dojox → Charting |
---|---|
Owner: | changed from Adam Peller to Eugene Lazutkin |
comment:2 Changed 13 years ago by
comment:3 Changed 13 years ago by
Milestone: | → tbd |
---|
mark all (open) tickets w/blank milestones to be "tbd"; their milestones need to be set to a version number or to "future"
comment:5 Changed 10 years ago by
Cc: | cjolif added |
---|
For the line chart as this is the subject of this ticket. I see two different behaviors depending on how you specify your data.
- If data are specified by indexed array [0, 5, null, 6, 1 ...] the behavior is a gap in the line (this is the behavior the reporter wanted, and apparently this is here now). This is a behavior that make sense even if you might want a different one (i.e interpolate).
- If data are specified by objects array [ { x: 0, y : 0}, {x: 1, y: 5}, {x: 2: y: null}, {x: 3...} ..] then the behavior is that the chart is going down to 0 on the missing data point. If y is not null but missing then the chart is not displayed at all. This is not really what one would expect.
I think we should provide consistent behavior whatever is the way the data are specified. with 2 options: either gap or interpolation.
comment:6 Changed 9 years ago by
comment:7 Changed 9 years ago by
I am interested in a way I can have custom breaks in the interpolation when the data is specified by objects array[ {x:0, y:0}, {x:1, y:5}, {x:2, y:null}, ...]. I need to do this because the values that are missing are invalid, rather than 0 and interpolation would not be good, because I can't show that the values are invalid. Also, plotting them on different series doesn't quite work because I need to have a common legend.
Could you point me to the code where the line is generated and how I can insert a break whenever there are these null/breaks/invalid values? It'd be good if I can patch it locally on my server for this custom application.
comment:8 Changed 9 years ago by
Milestone: | future → 1.8 |
---|---|
Owner: | changed from Eugene Lazutkin to cjolif |
Status: | new → assigned |
comment:10 follow-up: 11 Changed 9 years ago by
Thanks for the wonderful fix. I love it. One behavior that was changed with this latest patch is if the first point is null, nothing is drawn. So in your example, this works exactly what you expected it
var seriesB = [2, 3, null, null, 4, 5, null, 6, 7];
But
var seriesB = [null, 2, 3, null, null, 4, 5, null, 6, 7];
doesn't render at all. In fact,
var seriesB = [null, 2, 3, 4, 5, 6, 7];
rendered before, but not with the latest patch
comment:11 Changed 9 years ago by
Replying to cheewe:
Thanks for the wonderful fix. I love it. One behavior that was changed with this latest patch is if the first point is null, nothing is drawn. So in your example, this works exactly what you expected it
var seriesB = [2, 3, null, null, 4, 5, null, 6, 7];
But
var seriesB = [null, 2, 3, null, null, 4, 5, null, 6, 7];
doesn't render at all. In fact,
var seriesB = [null, 2, 3, 4, 5, 6, 7];
rendered before, but not with the latest patch
I can confirm this behavior. We have taken to 'padding' the lowest and highest null values as a zero, which causes the drawer to recognize there is a piece of data at said point. If the next most value is null the line will draw from "out of nowhere" as you would desire. eg:
var a = [null, null, 2, 3, null] // becomes a = [0, null, 2, 3, 0]
the 3 -> 0 "drop" is shown in line, but the 0->null->2 draws from 2 and continues to 3.
Otherwise, without the 0 padding, the beginning of the line ignores the datapoints all together. eg:
var a = [ null, null, 2, 3 ]
will only show 2 datapoints, with a "2" value at index 0 (when it should be index 2)
comment:13 Changed 9 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:14 Changed 9 years ago by
Thanks. Here's the use case for discussion. Let's say we are drawing 2 lines on the same chart: Series A: [null, 2, 3, null, 3, 6] Series B: [3, 2, 5, 6, 7]
Prior to patching, both lines are drawn. After the patch, Series A will not be drawn. It would be really nice if both lines would be drawn, but Series A starts with a blank, and then 2 abd 3, and then a break and 3 and 6.
comment:15 Changed 9 years ago by
cheewe, thanks for reporting this. I will have a look at that. While I start investigating this can you let me know if you get a similar behavior with other charts than line plots?
Should the missing point be interpolated? What about other charts? Currently I use the same code for area, lines, scatter charts, or a combination of them. What to do about stacked charts?
I understand the negative (the problem). I don't understand the positive counterpart (the solution). At least I don't have a clear unified concept of how to deal with the problem. At the moment your proposal calls for a splitting the line chart off, reverting to the custom code, which is not good --- the code bloat galore.