Sort charts in ascending order

Hi there,

I have faced a problem, while tried to display the values in ascending order in Event visualiser and Visualisation app.

What I am trying to achieve:

  1. I have selected Child Programme tracker
  2. Selected MCH OPV dose dataElement, which has linked to the options MNCH Polio dose (0-3)
  3. I have tried to build first chart on Event visualiser
  4. Created program indicators for MCH OPV dose - for each option separately

  1. Tried to apply sort the values ascending or descending order, but nothing happened.


  1. Sorting High to Low/Low to High in Event visualiser and Visualiser app doesn’t work.

  2. Event visualiser in order to sort uses options’ sorting order
    Moreover, when I tried to display sorted chart on my live-instance,

    I have got empty screen

  3. I found difference in counting the same value in Event visualiser and program indicator. Please compare the pictures above

Below I have attached json metadata for DHIS 2 Demo - Sierra Leone for demo purposes. And this is the version of DHIS2 where all the actions has been tested

Sort_chart_asc.json (29.1 KB)

So question is how this task can be done? Maybe @dhis2-analytics or @tracker-analytics can help me?

Thank you



Thank your for the detailed post! I believe you are testing in 2.36dev (what version is your live instance?) Did you try to run analytics export and clear the cache after testing?

I tested in the Event Visualizer and it seems to work:

And in the Event Visualizer app in 2.36Dev:

Maybe there’s a difference in understanding how the sorting is working? For example in the image below, it counted Tonkolili to be less than Kono even though it has in total nine more people than Kono!

Hi @Gassim,

Thank you for your reply.
Could you please try to take only MCH OPV dose data element in Child programme and try to build sorted chart in Event visualiser? I am trying to sort values between the options, not between the OUs.
I am using dhis2.36.10

Thank you @Gassim

1 Like

Thanks @Ulanbek!

I see maybe that’s the issue here. For instance, in the images I posted above, I can’t really sort Male/Female options!

@Gassim, even if you will create program indicators it would not work. And additionally was surprised when there is differences in number of counting sometimes.


1 Like

Thanks @Ulanbek! I also posted this topic to the developers :pray:

1 Like

@Gassim so should I report this as bug or not? :thinking:

1 Like

Sure! With all the info you posted I guess we can create a ticket in Jira for follow up and see what comes up! Thank you so much! :grin:

1 Like

Thank you @Gassim :+1:
Followed to your suggestion, I have created JIRA ticket :

1 Like

Thank you @Ulanbek!

It seems that the sorting would be for the first value in the series. It’s how the sorting is done but it’s not visible in the first screenshot you posted because it’s grouped by year. If you change it to monthly and sort high to low it will order based on the first option in the series (Dose 0) but will not sort the series. See the screenshot below:

The sorting when there is an option set will always sort based on the first value of the option set but will not sort the option set. This becomes more clear when the period is changed to monthly, but also if we have several years, the sorting will be based on the first option in the option set.

This explains why this was sorted from high to low.

@Ulanbek, initially this is not a bug; however, we can change it to a feature request? But it seems that this gets complicated and needs more discussion. For example, in the screenshot below:

Would it actually be considered correct if it were sorted as the following chart?


Hi @Gassim,

Thank you for your attempt to help. The thing is @Gassim I need this chart for single year or month, without comparing few years or months between.
Yes, if you compare them it works, but inside single year, it sorts only by the name of options or put based on options sortOrder property.

Let’s wait what analytics group can propose for us :slight_smile:

1 Like

Hi @Ulanbek,

I got a suggestion from @jan:

if the colors are not important, he could of course swap series/category and then sort high to low, so that there’s just one series dimension and multiple categories

1 Like

Hi @Gassim & @jan

Thank you for your interesting solution. Yes, this can be used for now as a solution of the problem, but anyway would be great if analytics group could make the charts more flexible. Let’s wait.

Regards, Ulanbek

1 Like