This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
gauges:dynamic_labels [2016/09/21 01:52] c0nnex created |
gauges:dynamic_labels [2020/12/23 14:07] (current) c0nnex [Dynamic Colors] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Dynamic Labels in Gauges ====== | ====== Dynamic Labels in Gauges ====== | ||
- | Using dynamic labels you can make your gauges change the appearance based on data values. Those can be changed either by user request or normal data.\\ | + | Using dynamic labels you can make your gauges change the appearance based on data values. Those can be changed either by user request or normal data. It is possible to replace image-bands by dynamic labels, without any performance loss.\\ |
The extended Tag looks as follows:\\ | The extended Tag looks as follows:\\ | ||
<code> | <code> | ||
Line 35: | Line 35: | ||
The value of the ''TextExpression'' will be used as Parameter 0 for the format string.\\ | The value of the ''TextExpression'' will be used as Parameter 0 for the format string.\\ | ||
It is possible to use all standard formatting rules according to [[https://msdn.microsoft.com/en-us/library/txafckwd(v=vs.110,d=hv.2).aspx#Anchor_0|Composite Formatting]] | It is possible to use all standard formatting rules according to [[https://msdn.microsoft.com/en-us/library/txafckwd(v=vs.110,d=hv.2).aspx#Anchor_0|Composite Formatting]] | ||
+ | |||
+ | ===== Dynamic Colors ===== | ||
+ | The <Color>-Tag can be expaned to contain dynamic expressions for the color. | ||
+ | <code> | ||
+ | <Color Background="Transparent" Foreground="White"> | ||
+ | <BackgroundValue></BackgroundValue> | ||
+ | <ForegroundValue></ForegroundValue> | ||
+ | </Color> | ||
+ | </code> | ||
+ | If BackgroundValue/ForegroundValue tags are present the default values will be ignored and the given expressions will be evaluated. Expressions have to be in SPAD.neXt format (see custom expression) and will always be interpreted as a string. | ||
+ | |||
+ | To reference Gauge/Profile/Device scoped variables in the expression you can use the prefixes GAUGE: PROFILE: DEVICE: | ||
+ | |||
+ | Example: | ||
+ | <code> | ||
+ | <Color Background="Transparent" Foreground="White"> | ||
+ | <BackgroundValue>[GAUGE:MY_COOL_VARIABLE_NAME]</BackgroundValue> | ||
+ | <ForegroundValue>[DEVICE:MY_EVEN_COOLER_VARIABLE_NAME]</ForegroundValue> | ||
+ | </Color> | ||
+ | </code> | ||
+ | |||
+ | The expression can eiter return a [[https://docs.microsoft.com/en-us/dotnet/api/system.drawing.knowncolo|KnownColor]] or a hexadecimal value in form '#AARRGGBB' ([[https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32|ARGB32]]) | ||