The Order of which a series is displayed can be a little tricky to work with. If no order is defined in the chart, the chart will display your data according to the sort order defined in the View that you are using. So excluding the order clause from the chart can give you a more dynamic way of adjusting your charts, as you won’t need to do xml customizations. Relying on the view also limits your sorting options to name fields or dates. I.e. you cannot use the View settings to order on aggregated fields.
However, it is often needed to specify one or more order clauses to make sure your data is presented properly.
To specify how data is ordered, or sorted, we utilize the Order clause in the fetchcollection in the xml.
In this example I have added two order clauses to a case chart.
The first line is the primary sort order and the following line is the secondary sort order. That way you can control the sort orders by adding the order clauses in the correct order. That was too many “orders” for one sentence.
- Order clauses can only be set for fields on the primary entity
- When using option sets as the basis of a series, the series get ordered according to the value of the option set and not its label. However, it seems that this only applies if an order clause has not been added to the fetchcollection
- More info on MS website can be found here http://msdn.microsoft.com/en-us/library/gg309565.aspx#orderby_aggregate
- If you need to sort on a linked entity, please see this blog post