The problem
Normally, x-axis sorting is just determined by Views' built-in sort criteria and that works well enough.
However, in the scenario also described by #2629018: Fix grouped display for "incomplete" result sets, when you having "holes" in your underlying data, the order of the x-axis can become arbitrary, with (currently) no way to fix this.
An example
Using the same example as in the other issue, but this time with a missing value for country A:
Country | Year | GPD
---------------------
A | 2012 | 8 T$
A | 2014 | 10 T$
B | 2012 | 3 T$
B | 2013 | 4 T$
B | 2014 | 5 T$
This will lead to the following chart:
(In this simple example, sorting descending by Country name would actually fix this, but this stops working when both countries have missing values.)
Proposed solution
Add an option to sort the x-axis by a custom field.
This will probably only be necessary if the underlying data does have "holes" in it, but could also be a helpful shortcut for (inexperienced) users to easily apply sorting in other cases.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2689837-2--x_axis_sorting.patch | 5.59 KB | drunken monkey |
screenshot.png | 7.63 KB | drunken monkey |
Comments
Comment #2
drunken monkeyPatch attached, based on #2629018: Fix grouped display for "incomplete" result sets. Please test/review!
Comment #3
herd45 CreditAttribution: herd45 as a volunteer commentedI've tested and this works as expected