Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to order legend values which appears on Mouse Hover in Line chart?

I have a line chart, it is ordred properly but when I hover my mouse over to each data point, those values are not in the order I want. how do I change that? Example screenshot is shown below:

In Above screenshot I hovered over to June and I got All legents but I want to order this legend by Value not Legend lable. How do I do that?

  • dm-p's avatar
    dm-p
    6 years ago

    Hi Anonymous,

    In both examples, the fields are unchanged and look like this:

    Note that the Tooltips field is empty.

    The difference between examples is that in the second one, I created a column called Country Sort that I used to sort the Country column by, as shown in the article I linked in my above post (specifically this section), e.g.:

    This is because the visual itself does not allow (or think it needs to allow) sorting, so you can force the Legend value to sort by using the sort by column approach.

    You will need to determine how this sort value is generated, based on your data. Note that values for each value of the field that goes into Legend will need to be unique for your sort column. Here's a partial table of how these fields look side-by-side so you can see how you might want this to work in your report:

    This is also a design pattern you would want to use to create ordinal attributes that shouldn't sort alphabetically, e.g. month name.

    Good luck!

    Daniel


    If my post helps, then please consider accepting as a solution to help other forum members find the answer more quickly 🙂

6 Replies

  • dm-p's avatar
    dm-p
    Icon for Super User rankSuper User

    Hi Anonymous,

    The order is dictated by the field you're using in the Legend box - you'll notice that the values are sorted alphabetically.

    If you want to change this, you'll need to assign a sort by column to the field you're using.

    Here's an example with some data I have - countries are sorted alphabetically:

    Initial chart - sorted by field value

    Now, I've applied a custom order to my countries - note that they appear differently:

    Same chart, after modifying how the field is sorted (by another column)

    You should be able to see the differences between both examples, including the legend sort order.

    Hopefully this should be all you need to get moving. Good luck!

    Daniel


    If my post helps, then please consider accepting as a solution to help other forum members find the answer more quickly 🙂

    • Anonymous's avatar
      Anonymous
      Not applicable

      I see. Thank You very much for your time. is it possible for your to show a screenshot of your Visualization fields on the right? I was thinking it is something to do with tooltips. 

      • dm-p's avatar
        dm-p
        Icon for Super User rankSuper User

        Hi Anonymous,

        In both examples, the fields are unchanged and look like this:

        Note that the Tooltips field is empty.

        The difference between examples is that in the second one, I created a column called Country Sort that I used to sort the Country column by, as shown in the article I linked in my above post (specifically this section), e.g.:

        This is because the visual itself does not allow (or think it needs to allow) sorting, so you can force the Legend value to sort by using the sort by column approach.

        You will need to determine how this sort value is generated, based on your data. Note that values for each value of the field that goes into Legend will need to be unique for your sort column. Here's a partial table of how these fields look side-by-side so you can see how you might want this to work in your report:

        This is also a design pattern you would want to use to create ordinal attributes that shouldn't sort alphabetically, e.g. month name.

        Good luck!

        Daniel


        If my post helps, then please consider accepting as a solution to help other forum members find the answer more quickly 🙂