Apologies if this is already fixed in dev or should be discussed elsewhere.
If I create a chart and a chart add-on in views, and set them to share an y-axis, a bug manifests:
In charts_plugin_style_chart.inc, when render() is called, first the parent chart is rendered. Then the chart add-on is rendered. The resulting output of both views are combined and rendered by the respective chart engine.
The way render() is written means that the combined chart is limited by the parent chart values and labels.
Here is an example:
Parent chart
label - value
1 - 10
2 - 11
3 - 12
4 - 13
Chart add-on
label - value
2 - 10
3 - 11
5 - 14
One would assume the combined chart would merge the labels as such: 1, 2, 3, 4, 5 and output each line ( or whatever chart type chosen ) according to which labels it has a value for.
Instead, the combined chart uses only the parent chart labels: 1, 2, 3, 4 and outputs the parent chart line correctly. The chart add-on line throws away its labels and instead just use the parent chart labels. Thus, the chart add-on line outputs 1:10, 2:11, 3:14 when it should really output 2:10, 3:11, 5:14
I hope this makes sense.
Comments
Comment #1
Roensby commentedI'll just post further thoughts here in order not to clutter my issue description.
Parent chart and chart add-on are sorted individually. This is possible to do, but probably shouldn't be. As far as I can see it makes no sense for two data series sharing axes to be sorted differently. Otherwise, they might as well be using their own graph. Thus, it may be prudent to disable sorting options for a chart add-on and simply make it "snap" to the parent view display sorting.
If this is a sensible solution to the problem, there is still the practical issue of merging labels between two charts: since the sorting method is determined by the parent view display, we cannot merge labels post-view render, since we have no idea in which order to merge the labels.
I suppose one solution is to disallow view sorting for all chart displays and only allow predefined primitive sorting methods in the chart options, such as alphabetically, numerically, etc. In this way, we know the sorting method at the time of label merging.
Comment #2
Roensby commentedComment #3
Roensby commentedComment #4
Pierre.Vriens commentedSorry @CChow it took so long to get back to you about this support request (but I do so now). Did you ever find the answer / solution for this issue? I bet it still applies.
If so, could it be that the patch in #2052429-12: Make multiple series charts easier to create through Views would also address / resolve this issue? I haven't had the time yet to do any experiments / reviews to find the answer to my question here, but I definitely think it is worth to do some more research in that direction. Which is also why I'm updating the status of this issue now.
Thoughts?
PS: note the parent issue I'm adding, you know what that means, right?
Comment #5
Pierre.Vriens commentedComment #6
bluegeek9 commentedThank you for your contributions to this issue. As Drupal 7 has reached its End of Life and is no longer supported, we are closing this issue. We encourage you to upgrade to a supported version of Drupal.