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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drunken monkey created an issue. See original summary.

drunken monkey’s picture

Status: Active » Needs review
FileSize
5.59 KB

Patch attached, based on #2629018: Fix grouped display for "incomplete" result sets. Please test/review!

herd45’s picture

I've tested and this works as expected