4 Replies Latest reply: Jul 7, 2011 9:29 AM by Johan Idh RSS

    Continuting colors on multiple graphs

      Hello everyone,

       

      I had a question regarding colors. At the moment i have two bar graphs running. The first one, for example, uses a base and calculates the number of individual entries. (A,B,C,D). The second one contains the base, with a index number next to it, regarding an issue (A1, A2, B1, B2, B3, C1, etc.)

       

      my question is: would there be a way to sync colors between the two graphs? For example, on the first bar graph, the bar "A" is Red, "B" is Blue, "C" is green, and making the second graph reflect that such as "A1" is Red, "A2" is Red, "B1" is blue, and so on.

       

      Qlikview also recognizes the two charts with listboxes, so if i select "A" from a list box, "A1" and "A2" both come up in the graphs

       

      thanks

        • Continuting colors on multiple graphs
          Leonard Short

          In your chart properties, click on the + next to your expression. Select 'Background Color' and on the right open the expression editor under definition.

           

          From there, its just an if statement, if(entry = A, red, if(entry = B, blue,if(entry = C, green,if(entry = D, yellow))))

          There are several ways you can set the color codes in the above statement I tend to use rgb(0,0,0) type format.

           

          Copy & paste the final if statement to any chart you want to have the same color scheme for.

            • Re: Continuting colors on multiple graphs
              John Witherspoon

              Alternatively, map yourself some colors:

               

              Colors:
              LOAD * INLINE [
              entry, R, G, B
              A,255,100,100
              B,100,100,255
              C,100,255,100
              D,200,200,100
              ];

               

              And then in the color expressions:

               

              =rgb(R,G,B)

               

              Though you'll probably want this so that you get default colors when adding new values that you haven't mapped:

               

              =if(R,rgb(R,G,B))

                • Re: Continuting colors on multiple graphs

                  thanks for getting back to me...i tried your method, and for some reason, all of the bars come up as jet black (rgb(0,0,0)). I cant seem to figure out why this is.

                   

                  in my script, I added

                   

                  Colors:

                  LOAD * INLINE [

                  entry, R, G, B
                  AC,255,100,100
                  AM,100,255,100
                  BC,100,100,255
                  DP,100,100,100
                  PE,200,200,100
                  PS,200,100,200
                  RM,100,200,200
                  SO,0,0,200
                  SS,0,200,0
                  TM,200,0,0
                  ];

                   

                  In the background color expression, i added

                   

                  =rgb(R,G,B)

                   

                  for some reason, doing this turned every entry jet black. Any ideas on what might be the fix for this?