Dynamic legend based on active Text set

DataGraph Forums Technical Support Support Desk Dynamic legend based on active Text set

Tagged: ,

  • This topic has 5 replies, 2 voices, and was last updated 4 years ago by sgp.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #4782
    sgp
    Participant

      I’ve created a scatter plot, colour coded the fill by Category using a colour scheme and then used a mask based on a Text set to control the points that are plotted. I’ve turned off Category “A” (ref points) in the Text Set but it still appears in the legend. Is there any way to make the legend dynamic to reflect the active categories in the mask?

      2020-09-10_13-06-04

      #4784
      dgteam
      Moderator

        Here is a way to make it work.

        You have to switch from using the Custom Legend (which will always show all the entries) to using the default Legend command that is populated using a hidden Pivot command to provide the legend entries.

        Here is a summary of the steps:

        1 – Delete the Custom Legend.

        2 – Add the Legend command from the tool bar.  Delete the Legend entry at the bottom of the expanded Points command, so that the legend at this point is blank.

        Now for the Pivot command …

        3 – Highlight all three columns.  Click the Pivot command icon in the tool bar.

        4 – Add the same mask you are using for the points into the Pivot command ( you can copy and paste the mask using the gear menus or you can create a group and put the mask at the group level.  I personally recommend the second option as you can see more clearly what the mask is.

        5 – On the Pivot command you will need to change Group bars to ‘By Column’ and change the Fill to a ‘Color Scheme’, as shown below.

        PivotOptions

        6 – Check the Hide button on the top right of the Pivot command.

        Now you should have the dynamic Legend and only showing the points.

        Mask

        If any of the steps are not clear please let us know!

         

        #4785
        sgp
        Participant

          Worked perfectly – thanks 🙂

          I guess my next question is why is this not the default behaviour when creating legends with masks?

          #4786
          dgteam
          Moderator

            That is a good question!

            Part of the reason is that these functionalities were created at different times.  The Pivot command is more recent than the Points and the Text set is a very recent addition.

            The Legend command is unique among the commands as it will monitor the content of other commands to populate the legend.  The other commands, including the Custom Legend, are independent of one another.  The Pivot is sending its color scheme data to the Legend, but the Points command does not.

            Given the masking functionality, I agree we need should consider whether the Legend could be ‘smarter’ for other commands as well.

            Won’t happen for version 4.6, but we will think about for the next version.

             

            #4787
            sgp
            Participant

              Great and thanks for considering the feature request.

              #5168
              sgp
              Participant

                As a postscript to this thread, I’m wondering whether a future version could have the ability to make legend symbology reflect what is actually plotted in the current graph window extent rather than data table related i.e. taking my above example, a zoomed in  area centred around x values >25 would only have the legend categories B, C and D showing

                As ever with DataGraph, there are workarounds (which is great) but…

              Viewing 6 posts - 1 through 6 (of 6 total)
              • You must be logged in to reply to this topic.

              DataGraph Forums Technical Support Support Desk Dynamic legend based on active Text set