# Using Evaluator in status bar to calculate color of bar graph?

**URL:** <https://resource.dopus.com/t/using-evaluator-in-status-bar-to-calculate-color-of-bar-graph/50685>\
**Category:** Help & Support\
**Created:** [May 5, 2024, 11:54pm UTC](https://resource.dopus.com/t/using-evaluator-in-status-bar-to-calculate-color-of-bar-graph/50685 "2024-05-05T23:54:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MartO](https://resource.dopus.com/user_avatar/resource.dopus.com/marto/32/54727_2.png) [@MartO](https://resource.dopus.com/u/MartO)\
**Post date:** [May 5, 2024, 11:54pm UTC](https://resource.dopus.com/t/using-evaluator-in-status-bar-to-calculate-color-of-bar-graph/50685/1 "2024-05-05T23:54:23Z")

</div>

Hi all,

I'm tinkering with my status bar and trying to get a bar graph colored via an Evaluator (which would allow me to use all kinds of conditions for the colors).

This is a simple example:  
`{bg+w=-1,b=n,g=0,t=n,f=3,v=du/dt,c=#666666} {du} / {dt}`

Now I'm trying to change the bar color. I tried returning the whole bg code from an Evaluator:  
`{= "{bg+w=-1,b=n,g=0,t=n,f=3,v=du/dt,c=#666666}" =} {du} / {dt}`  
but that only prints out the code rather than turning it into a bar graph.

I tried returning only the actual color from the Evaluator:  
`{bg+w=-1,b=n,g=0,t=n,f=3,v=du/dt,c={= "#666666" =}} {du} / {dt}`  
but then the bar is shown with some default color instead, so my Evaluator result is ignored.

Then, just for fun, I tried inserting a variable (set to "#666666"), which also failed:  
`{bg+w=-1,b=n,g=0,t=n,f=3,v=du/dt,c={var:glob:my_color}} {du} / {dt}`

Changing the text color with an Evaluator works perfectly, btw:  
`{bg+w=-1,b=n,g=0,t=n,f=3,v=du/dt,c=#666666} {= "<#FFFFFF>" =}{du} / {dt}</#>`

So what am I doing wrong? I would guess that nested curly brackets aren't allowed? Do I have to escape them somehow? Is there another way of doing this? Or is it just not possible right now?

Thanks!

---

<div class="post-metadata">

**Author:** ![Jon](https://resource.dopus.com/user_avatar/resource.dopus.com/jon/32/12713_2.png) [@Jon](https://resource.dopus.com/u/Jon)\
**Post date:** [May 6, 2024, 12:26am UTC](https://resource.dopus.com/t/using-evaluator-in-status-bar-to-calculate-color-of-bar-graph/50685/2 "2024-05-06T00:26:05Z")

</div>

Not possible, but evaluator inserts can output simple HTML and change the color that way as you've discovered. There is a way to render bar graphs via HTML, but I don't have the info on hand.

---

<div class="post-metadata">

**Author:** ![Jon](https://resource.dopus.com/user_avatar/resource.dopus.com/jon/32/12713_2.png) [@Jon](https://resource.dopus.com/u/Jon)\
**Post date:** [May 6, 2024, 6:05am UTC](https://resource.dopus.com/t/using-evaluator-in-status-bar-to-calculate-color-of-bar-graph/50685/3 "2024-05-06T06:05:36Z")

</div>

We've never documented this since it's only really used internally, so you might have to play around a bit. Basically the code is `<%bg>` for a bar graph; it then takes a number of parameters separated by ^ symbols.

`<%bg:value^total^width^color1^color2^color3^backcolor^textcolor^gradient^frame>`

value: current value  
total: total value  
width: width in pixels  
color1: fill color \< 90%  
color2: fill color \> 90%  
color3: not used (?)  
backcolor: background fill  
textcolor: overlay text color  
gradient: gradient type (3 or 4)  
frame: frame type

---

<div class="post-metadata">

**Author:** ![MartO](https://resource.dopus.com/user_avatar/resource.dopus.com/marto/32/54727_2.png) [@MartO](https://resource.dopus.com/u/MartO)\
**Post date:** [May 6, 2024, 1:38pm UTC](https://resource.dopus.com/t/using-evaluator-in-status-bar-to-calculate-color-of-bar-graph/50685/4 "2024-05-06T13:38:37Z")

</div>

Wow, Jon, that's brilliant - thank you for sharing!!

I did play around and here's what I'm using for now (in case anybody is interested...):

```auto
{=myval=42; mytot=99; mycol="#777777"; "<%bg:" + myval + "^" + mytot + "^-1^" + mycol + "^" + mycol + "^" + mycol + "^-1^no^0^3> =} <#FFFFFF>{du} / {dt}</#>

```

value: _myval_, calculated as needed  
total: _mytot_, calculated as needed  
width: -1 (full width)  
color1: _mycol_, calculated as needed (all colors to the same value, no gradient)  
color2: _mycol_, calculated as needed  
color3: _mycol_, calculated as needed  
backcolor: -1 (no background)  
textcolor: ~~left out (probably illegal 😉 but seems to suppress the percentage overlay) NOPE, doesn't work, see answer below...~~ **"no" to suppress the percentage overlay, see answers below...**  
gradient: 0 (no gradient)  
frame: 3 (fill section, enables by own text overlay)

This is the result, if configured for used disk space:

![temp (1)](https://resource.dopus.com/uploads/default/original/3X/2/c/2c8ddefe77ed8f18adb8e8417125f1cdc774c3b5.png)

Evaluators are great addition to an already great product!  
Thank you!

---

<div class="post-metadata">

**Author:** ![MartO](https://resource.dopus.com/user_avatar/resource.dopus.com/marto/32/54727_2.png) [@MartO](https://resource.dopus.com/u/MartO)\
**Post date:** [May 6, 2024, 2:09pm UTC](https://resource.dopus.com/t/using-evaluator-in-status-bar-to-calculate-color-of-bar-graph/50685/5 "2024-05-06T14:09:09Z")

</div>

Sorry, my eyes deceived me: leaving out the text color **does not** suppress the percentage overlay. It's still printed behind my own overlay text (just in black on dark gray in the test above). Giving it the color of the bar isn't a good option either, for it only works once the bar is long enough. I'm trying to choose a color now that is just unobtrusive enough for the text to be hard to spot...

So the question remains: Is there a way to suppress the percentage output?

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [May 6, 2024, 6:50pm UTC](https://resource.dopus.com/t/using-evaluator-in-status-bar-to-calculate-color-of-bar-graph/50685/6 "2024-05-06T18:50:09Z")

</div>

Specifying `no` for the color seems to work, as long as you also include a frame type after it. E.g.:

```plaintext
<%bg:75^100^70^#0000ff^#00aa00^#ffffff^#003333^no^3>

```

---

<div class="post-metadata">

**Author:** ![MartO](https://resource.dopus.com/user_avatar/resource.dopus.com/marto/32/54727_2.png) [@MartO](https://resource.dopus.com/u/MartO)\
**Post date:** [May 6, 2024, 6:59pm UTC](https://resource.dopus.com/t/using-evaluator-in-status-bar-to-calculate-color-of-bar-graph/50685/7 "2024-05-06T18:59:05Z")

</div>

Ooooh - I was _so_ close... I tried "-1" and "n"... 😆

Thank you!
