aaronbannin edited a comment on issue #5888: Display Null values as 0 on 
Timeseries Charts
URL: 
https://github.com/apache/incubator-superset/issues/5888#issuecomment-422967997
 
 
   Perhaps the underlying problem is that the data being passed into the chart 
does not have a value for every x-axis tick? This may be solvable without 
editing the NVD3. 
   - Generate the x-series based on time duration and grain. If range is Jan 1 
- Jan 3 with daily granularity, then generate `[Jan 1, Jan 2, Jan 3]`.
   - Left join generated series into data set. This would generate `{Jan 1: 10, 
Jan 2: None, Jan 3: 7}`. Each metric would need to be left-joined into the 
source series.
   - Lines should then skip over missing points.
   
   This logic should work for time series graphs. Jan 2 occurs between Jan 1 
and Jan 3, regardless of if any data is in the returned set. The approach would 
not work for arbitrary dimensions as Superset does not have knowledge of the 
set of values. Furthermore, this would mean that the first x-axis bounds would 
be determined by the date range and not the returned set.
   
   In response to approaches:
   - null to be replaced by 0: This does feel like a hack that alters the 
underlying data.
   
   - lines in line chat to be broken off, show a line on the left, and a line 
on the right: I agree with @davidhassan that this is probably the best 
solution. It accurately visualizes the returned data.
   
   - lines to skip over missing points, connecting the dots on either side: 
This seems like the worst option as the visual is out of sync with the 
underlying data (more so than replacing with 0s, in my opinion, as 0 is 
"closer" to null than other values).
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to