fix(Highcharts plugin): fix updating point x value #121
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.
A problem arises when the graph has 2 or more series and you need to update the points. When the point.update function is called, the value of x is updated to the index in the flat array.
For example, the graph has 2 series:
s1 = [{y: 10}, {y: 15}, {y: 42}], s2 =[{y: null}, {y: 12}, {y: null}]
, and some categories like['A', 'B', 'C']
.Before point.update Highcharts has this point representation
s1 = [{y: 10, x: 0}, {y: 15, x: 1}, {y: 42, x: 2}], s2 =[{y: null, x: 0}, {y: 12, x: 1}, {y: null, x: 2}]
. In this case,x
means the index of the category array, I suppose.Then after updating, the value of the point x changes
s1 = [{y: 10, x: 0}, {y: 15, x: 1}, {y: 42, x: 2}], s2 =[{y: null, x: 3}, {y: 12, x: 4}, {y: null, x: 5}]
.Highcharts seems to set the index from the merged data as if it were a flat array
[{y: 10, x: 0}, {y: 15, x: 1}, {y: 42, x: 2}, {y: null, x: 3}, {y: 12, x: 4}, {y: null, x: 5}]
.I added point.x to the update function to save information about the value of
x
.