Oracle Apex: Bar Chart not recognising order by (date)

 Problem

Even though you have a clear order by in your grpah, the series is not show in date order.


 

 Solution

The order by is caluclated as if the date is a string. Even if you cater for this as I have above, there are a few features that could interfere with the order by in Apex. See this post for details.

"With 5.1.3, we introduced data densification logic to automatically handle the injection of missing data points in a multi-series query.  Any ORDER BY defined in the query will not be respected.  Prior to 5.1.3, numerous customers got caught out by having missing data points in the chart JSON, thus resulting in data elements being rendered incorrectly on their charts.  With patch releases we cannot introduce any UI changes, so the data densificiation logic is automatically applied to charts with multiples series of data.  For our next release, we have introduced a new 'Fill Gaps in Chart Data' chart-level option, that will allow you to essentially opt out of having the densification logic applied to your chart.  By default, the new option will be set to 'Yes'.  When set to Yes, we will apply data densification logic and default ordering by label, ascending.  This corresponds with the behaviour you currently experience with 5.1.3 & 5.1.4.  We have introduced an associated item, 'Sort Order', to allow you to define the ordering of the chart data - value-ascending, value-descending, label-ascending, label-descending. That 'Sort Order' option will only be available when 'Fill Gaps in Chart Data' is set to 'Yes'.  When set to No, our data densification logic will not be applied to the chart.  In that case, the customer will have to ensure that their chart query correctly handles the generation of a multi-series chart with a data point for every x-axis label.   For a single series chart, customers must use an ORDER BY clause in the chart query, to control the ordering of data elements."

 

As above, Fill Gaps in chart is set to "Yes" by default.

In my case, I changed this to "No", and it worked.


Acknowledgement

https://community.oracle.com/tech/developers/discussion/4099108/oracle-apex-jet-series-dont-take-in-consideration-the-order-by-clause-compared-to-old-chart

Comments