I'm making a weather widget and I want to use a gradient to show temperature in a bar graph.
What I have now (and works) is this:
Code: Select all
[mTemp0]
Measure=Plugin
Plugin=Plugin\WebParser.dll
Url=[mWunderXML]
StringIndex=56
MinValue=#Meteo.TMin#
MaxValue=#Meteo.TMax#
[mTemp1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[mWunderXML]
StringIndex=59
MinValue=#Meteo.TMin#
MaxValue=#Meteo.TMax#
...
[mtR0]
Measure=calc
Formula=mTemp0 <= ((#Meteo.TMax# - #Meteo.TMin#) / 2 + #Meteo.TMin#) ? ((mTemp0 - #Meteo.TMin#) * 255 / (#Meteo.TMax# - #Meteo.TMin#)) * 2 : 255
[mtG0]
Measure=calc
Formula=mTemp0 <= ((#Meteo.TMax# - #Meteo.TMin#) / 2 + #Meteo.TMin#) ? 255 : (255 - ((mTemp0 - #Meteo.TMin#) * 255 / (#Meteo.TMax# - #Meteo.TMin#))) * 2
[mtB0]
Measure=calc
Formula=mTemp0 <= ((#Meteo.TMax# - #Meteo.TMin#) / 2 + #Meteo.TMin#) ? 255 - ((mTemp0 - #Meteo.TMin#) * 255 / (#Meteo.TMax# - #Meteo.TMin#)) * 2 : 0
[mtR1]
Measure=calc
Formula=mTemp1 <= ((#Meteo.TMax# - #Meteo.TMin#) / 2 + #Meteo.TMin#) ? ((mTemp1 - #Meteo.TMin#) * 255 / (#Meteo.TMax# - #Meteo.TMin#)) * 2 : 255
[mtG1]
Measure=calc
Formula=mTemp1 <= ((#Meteo.TMax# - #Meteo.TMin#) / 2 + #Meteo.TMin#) ? 255 : (255 - ((mTemp1 - #Meteo.TMin#) * 255 / (#Meteo.TMax# - #Meteo.TMin#))) * 2
[mtB1]
Measure=calc
Formula=mTemp1 <= ((#Meteo.TMax# - #Meteo.TMin#) / 2 + #Meteo.TMin#) ? 255 - ((mTemp1 - #Meteo.TMin#) * 255 / (#Meteo.TMax# - #Meteo.TMin#)) * 2 : 0
...
[MeterTemp0]
Meter=Bar
MeasureName=mTemp0
x=20
Y=10
h=36
w=20
BarColor=[mtR0],[mtG0],[mtB0],192
BarOrientation=Vertical
DynamicVariables=1
[MeterTemp1]
Meter=Bar
MeasureName=mTemp1
x=21r
Y=10
h=36
w=20
BarColor=[mtR1],[mtG1],[mtB1],192
BarOrientation=Vertical
DynamicVariables=1
Now, if I want to change the gradient formula, I have to change it in all the measures. Is it possible to change the value of a variable and recalculate the formula to apply in the next measure? Something like
Code: Select all
[mtR]
Measure=calc
Formula=mTemp <= ((#Meteo.TMax# - #Meteo.TMin#) / 2 + #Meteo.TMin#) ? ((mTemp - #Meteo.TMin#) * 255 / (#Meteo.TMax# - #Meteo.TMin#)) * 2 : 255
[mtG]
Measure=calc
Formula=mTemp <= ((#Meteo.TMax# - #Meteo.TMin#) / 2 + #Meteo.TMin#) ? 255 : (255 - ((mTemp - #Meteo.TMin#) * 255 / (#Meteo.TMax# - #Meteo.TMin#))) * 2
[mtB]
Measure=calc
Formula=mTemp <= ((#Meteo.TMax# - #Meteo.TMin#) / 2 + #Meteo.TMin#) ? 255 - ((mTemp - #Meteo.TMin#) * 255 / (#Meteo.TMax# - #Meteo.TMin#)) * 2 : 0
[MeterTemp0]
Meter=Bar
MeasureName=mTemp0
x=20
Y=10
h=36
w=20
!SetVariable mTemp = mTemp0
BarColor=[mtR],[mtG],[mtB],192
BarOrientation=Vertical
DynamicVariables=1
[MeterTemp1]
Meter=Bar
MeasureName=mTemp1
x=21r
Y=10
h=36
w=20
!SetVariable mTemp = mTemp1
BarColor=[mtR],[mtG],[mtB],192
BarOrientation=Vertical
DynamicVariables=1
Jorge