![Welcome :welcome:](./images/smilies/bs.gif)
Currently in [mIndex1_UpDown], you have used IfAbove / IfEqual and IfBelowValue. Working fine with 3 colors, mainly red/green for "+" and "-" values.
What I'd like to do:
1.) Negative values are shown with the "-" minus and they are colored red. That's redundant in my thinking. Can we eliminate the "-" from the String? Probably via a simple RegEx? If I see red percentages I already know it's negative, would prefer removing the minus sign, relaxing my eyes and saving a pinch of space, you know... Don't kill me, yes, I like it perfectly customized...
2.) For the colors, I'd like to have two different colors for <0 = "DownSlow" (yellow) and <-3 = "DownFast" (red) and same for "UpSlow" (light green) and "UpFast" (regular green). I know this does not work with IfAboveEqualBelow. See below my coding attempt with a set of IfConditions. Problem: It gives strange results, not as designed - from my gut feeling, the operators "<" ">" do not work correctly with the String [mIndex1_UpDown]? But I wonder, why does IfAbove / IfEqual and IfBelowValue work on this string but not my IfConditions? Anything else I missed? Do I need to create another Calc measure to convert the string to a number and then use the IfCondition on this measure? Maybe a more elegant solution? Thanks so much...
Mordasiu's code:
Code: Select all
[mIndex1_UpDown]
Measure=WebParser
Url=[InfoIndex1]
Substitute="UNCH":"0"
StringIndex=3
IfAboveValue=0
IfAboveAction=[!SetOption "LabelIndex1_ChangePer" "FontColor" "#ColorUp#"]
IfEqualValue=0
IfEqualAction=[!SetOption "LabelIndex1_ChangePer" "FontColor" "#ColorSteady#"]
IfBelowValue=0
IfBelowAction=[!SetOption "LabelIndex1_ChangePer" "FontColor" "#ColorDown#"]
OnChangeAction=[!SetOption "LabelIndex1" "FontColor" "#ColorStockName#"] [!Redraw]
Code: Select all
[mIndex1_UpDown]
Measure=WebParser
Url=[InfoIndex1]
Substitute="UNCH":"0"
StringIndex=3
; Here we use IfConditions to set two different colors if below or above threshold (+.)3%
IfCondition=(mIndex1_UpDown <= -3)
IfTrueAction=[!SetOption "LabelIndex1_ChangePer" "FontColor" "#ColorDownFast#"]
IfCondition2=(mIndex1_UpDown > -3) && (mIndex1_UpDown < 0)
IfTrueAction2=[!SetOption "LabelIndex1_ChangePer" "FontColor" "#ColorDownSlow#"]
IfCondition3=(mIndex1_UpDown = 0)
IfTrueAction3=[!SetOption "LabelIndex1_ChangePer" "FontColor" "#ColorSteady#"]
IfCondition4=(mIndex1_UpDown > 0) && (mIndex1_UpDown < 3)
IfTrueAction4=[!SetOption "LabelIndex1_ChangePer" "FontColor" "#ColorUpSlow#"]
IfCondition5=(mIndex1_UpDown >= 3)
IfTrueAction5=[!SetOption "LabelIndex1_ChangePer" "FontColor" "#ColorUpFast#"]
OnChangeAction=[!SetOption "LabelIndex1" "FontColor" "#ColorStockName#"] [!Redraw]