Opened 11 years ago

Closed 8 years ago

Last modified 8 years ago

#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 11 years ago by Adam Peller

Component: DojoxCharting
Owner: changed from Adam Peller to Eugene Lazutkin

comment:2 Changed 11 years ago by Eugene Lazutkin

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.

comment:3 Changed 11 years ago by bill

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:4 Changed 11 years ago by Eugene Lazutkin

Milestone: tbdfuture

Moving all open ticketd to the future.

comment:5 Changed 8 years ago by cjolif

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.

Last edited 8 years ago by cjolif (previous) (diff)

comment:6 Changed 8 years ago by cjolif

See also #13903 and #11390

Last edited 8 years ago by cjolif (previous) (diff)

comment:7 Changed 8 years ago by cheewe

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 8 years ago by cjolif

Milestone: future1.8
Owner: changed from Eugene Lazutkin to cjolif
Status: newassigned

comment:9 Changed 8 years ago by cjolif

Resolution: fixed
Status: assignedclosed

In [27625]:

fixed #6812. Introduces a interploate property on plot2d/Default.js that allows user to specify which behavior they want on missing data points. The behavior is now as much as possible consistent between index-based and x-based data sets. !strict.

comment:10 Changed 8 years ago by 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

comment:11 in reply to:  10 Changed 8 years ago by dante

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:12 Changed 8 years ago by Adam Peller

#15003 is a duplicate of this ticket.

comment:13 Changed 8 years ago by Adam Peller

Resolution: fixed
Status: closedreopened

comment:14 Changed 8 years ago by cheewe

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 8 years ago by cjolif

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?

comment:16 Changed 8 years ago by cjolif

Resolution: fixed
Status: reopenedclosed

In [28143]:

fixes #6812. Please let me know if you experience other issues with this. !strict.

comment:17 Changed 8 years ago by cheewe

Works beautifully. Thanks!

Note: See TracTickets for help on using tickets.