Implement feature request #4237 plus refactor similar scale multi-axis functions #4247
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.
New feature
Implement feature request #4237
See new: sample/src/area/multi-axis-with-seriesname-arrays.xml
Note: it is left to the creativity of the user to visually disambiguate which plot is associated with which Y axis.
Extended application of this feature
The current style of mapping multiple series to a y axis is to include one yaxis config per series but set each yaxis seriesName to the same series name and then set show: false on all axes that are not required.
While not the purpose of #4237, the feature offers a more intuitive alternative that explicitly configures yaxis elements with the series that will be referenced to them (seriesName: []). This only requires including the yaxis elements that will be seen on the chart. This is how it works to the best of my limited knowledge.
Old way:
yax: ser
0: 0
1: 1
2: 1
3: 1
4: 1
Axes 0..4 are all scaled and all are be rendered unless the axes are show: false. If the chart is stacked, it's assumed that series 1..4 corresponding to the yaxis indices 1..4 are the series' that will be stacked.
Implementation of the extended feature
Use the new feature yaxis: seriesName: [] to simplify the specification of series inclusion in stacked charts, especially when combined with other series. Essentially, refactor Scales.sameScaleInMultipleAxes() and Scales.setMultipleYScales() to use yaxis: seriesName: [].
New way:
yax: ser
0: [0]
1: [1,2,3,4]
See stacked-column-with-line.xml
and c.f. stacked-column-with-line-new.xml
The new facility is backward compatible with the existing style via code that converts the old data structure to the new one.
If the chart is stacked (a global chart setting), it is assumed that any axis with multiple series is stacked. Multiple yaxes referencing multiple series in a stacked chart is not implemented (or rather doesn't do anything particularly useful yet), however it was noted that it does not break the chart. It essentially does what a user might expect it to do, which is add an additional Y axis.
Fix stacked chart y axis scaling: min and max were computed as the sum of the series min and max, not the min and max of the one-for-one summed datapoints in each series.
Minor fixes
Additional checks for undefined elements in CoreUtils.extendArrayProps().
Remove the duplicate outlier in boxplot-scatter.xml.
Type of change
Checklist: