4 Replies Latest reply: Mar 17, 2015 9:06 PM by Gus Feltham RSS

    Missing Legend from stacked bar chart

    Gus Feltham

      Is there an alternative to get the legend included for a stacked bar chart when colouring is done by expression? 

      If multi-coloured is chosen instead (to keep the legend) - how can I get the exact name or code for the system selected colours - so that a pie chart (for example) next to this with same categories can be set with matching colours?Missing legend from stacked bar

        • Re: Missing Legend from stacked bar chart
          Jonathan Poole

          For the latter you can create a table that details each color for each dimension value so that you can control each color to your liking.  If you need i can send an example.

           

          A nice trick (which i didn't know until very recently) to have Qlik generate some machine colors that will be the same between 2 charts (like a stacked bar where the 2nd dimension is the same dimension used in a seperate  pie chart) is as follows :

           

          color(fieldindex('City',City))

           

          where 'city' is arbitrary and represents the name of the grouping and City is a field name that represents your 2nd dimension in the stacked bar and only dimension in the pie.

           

          Give it a try !

            • Re: Missing Legend from stacked bar chart
              Gus Feltham

              Thanks Jonathan,

              Okay I made sure persistent colours were set for the pie chart I have next to the stacked bar chart – and that has kept same categories/same colours – great!

              The stacked bar chart has a legend if colour by dim, but as soon as I select by expression the legends vanishes…I have seen this issue also on a blog somewhere else.

              Not such an issue now that I have matching colours for multiple charts though

               

              I will try your colour (fieldindex) – an  example would be to have if possible.

               

              Thanks again!

               

              Gus Feltham

              Senior Data Analyst | Corporate Services

               

              +64 4 912 0352   x352