3 Replies Latest reply: Apr 4, 2017 12:18 PM by Ana Yakushi RSS

    Change Color of the Area layer

    Guy Hombleu

      Hi Guys,

       

      We're using GEO Analytics and QlikView to plot the turnover of our customers by zipcode of the customer adress.

      We would like to use a Color Scale from Red(lowest) to Green(highest). In QV the standard color modes/ shemes doesn't support this color scale. Is there an easy way to change the color scale to our requested scale?

        • Re: Change Color of the Area layer
          Ana Yakushi

          Hello Guy,

           

          You can use this expression to define the color of the areas on the map (change the Color Mode in the Area Layer's properties to "By Expression")

          =ColorMix1(value ,lowest_value_color, highest_value_color)

           

          In your case:

          =ColorMix1(your_value,red(), green())

          The value has to be scaled from 0 to 1.

           

          Hope it helps.

           

          Best Regards,

           

          Ana Yakushi

          Qlik GeoAnalytics

            • Re: Change Color of the Area layer
              Guy Hombleu

              Hello Ana,

               

              Thanks for your quick reply. Its almost seems to work for us. Now we're just figuring out our way to set our value correct.

               

              There are multiple zipcodes with a sum (Sales). Like this:

               

              Zipcode:       sum(Sales)

              1                  15.000

              2                  1.000

              3                  25.000

               

              Now we're looking for a way to plot zipcode '2' with color Red(Lowest sum(Sales)) and zipcode '3' with color Green(Highest sum(Sales)).

               

              Can you please help us a little with a correct formula for our value?

               

              Thanks a lot!

                • Re: Change Color of the Area layer
                  Ana Yakushi

                  Hello,

                   

                  The idea is to convert your values to a scale between 0 and 1, the formula to do this is:

                  (x-min(x))/(max(x)-min(x))

                   

                  So applying to your data:

                  x: aggr(sum(sales),zip)

                  min(x): min(total(aggr(sum(sales),zip)))

                  max(x): max(total(aggr(sum(sales),zip)))

                   

                  Replacing in the formula to get the "scaled sum(sales)":

                  (aggr(sum(sales),zip)-min(total(aggr(sum(sales),zip))))/(max(total(aggr(sum(sales),zip)))-min(total(aggr(sum(sales),zip))))

                   

                  Finally: ColorMix1((aggr(sum(sales),zip)-min(total(aggr(sum(sales),zip))))/(max(total(aggr(sum(sales),zip)))-min(total(aggr(sum(sales),zip)))),red(),green())

                   

                  Here is how it looks, applied to a simple example with States:colormix1.png

                   

                  Best Regards,

                   

                  Ana Yakushi

                  Qlik GeoAnalytics