Handling Null values in Chart #2854
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently, passing null in a chart series converts it to 0 or an empty string, which plots as zero.
This PR allows null values to be charted as missing or empty data. Converting them to 0 will impact graphs such as the Line graph and others that need to display each data point's value (or lack thereof). It updates the Writer to respect null values in the data series.
In addition, this PR adds the setDisplayBlanksAs option to the Chart Style, allowing users to choose how to display null values. These options are 'gap' (break the line chart), 'span' (connect lines over the null values to show trends), or 'zero' (display nulls as zero, as it the current default).
I considered setting 'zero' as the default as this is the current behaviour, but can't think of a use-case where null should be converted to 0. Happy to be corrected on this!
Fixes # (issue)
When you provide a null value in the chart series, it was converted to 0 in the chart.
This will now respect this value and omit the data point on any graph. This is especially useful for any time series data in line graphs, where there may be gaps in the data. This enables you to set how you'd like these to be plotted.
Checklist: