If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Dynamic map/chart palette thresholds number value

Started by Spyhop, 30 Apr 2015 01:30:13 PM

Previous topic - Next topic

Spyhop

Report Studio 10.2

I have a report with a map item where each geographic region's color is based on a three color palette
(i.e. stop light report Green=best,  yellow = good, Red = bad).

Based on a prompt/parameter I would like to dynamically switch between
    scenario 1) Green >= 80%, Yellow >= 50%, Red < 50%
    and
    scenario 2) Green >= 50%, Yellow >= 25%, Red < 25%

This is a simplified scenario, currently I have many (20+) conditional blocks each with different color thresholds for different prompt selections.
I was hoping to have 1 block and dynamically set the color thresholds. Is there a javascript solution for this?


bdbits

Instead of mapping the actual values, create expressions that consider all of the possibilities and map them to a set of numbers you can use for the colors you want to appear. Something like...

if (scenario1) then (
    if (what_makes_green) then (1) else (if (what_makes_yellow) then (2) else (if (what_makes_red) then (3) else (whatever)))
) else (
    if (scenario2) then (if (what_makes_green) then (1) else (if (what_makes_yellow) then (2) else (if (what_makes_red) then (3) else (whatever))))
)

Nest the if/else constructs as many times as needed. Depending on your conditions, a case statement might make an expression more readable.

Then in your map, it is the usual palette-mapping for the layer.