|
|
| Author |
Message |
KyRoo
Joined: 19 Oct 2007 Posts: 46
|
Posted: Wed Mar 12, 2008 9:42 am Post subject: Icon Scale |
|
|
Hi All,
Ive found an example how to display up down status on a weathermap.
I've seen that, if down you can display a dirrent icon that when it up, ...
I'm wondering if this can be done in some kind of scale.
like when the value is 0 get a red smily
when it is between 1 and 50 give a green smily
when it is between 50 and 75 a yellow smily
when it is between 75 and 100 a red one again
(this is an example, i cant to do this with other ranges and more pics)
Thanks,
kyRoo |
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2036 Location: United Kingdom
|
Posted: Sat Mar 15, 2008 1:23 pm Post subject: Re: Icon Scale |
|
|
| KyRoo wrote: | Hi All,
Ive found an example how to display up down status on a weathermap.
I've seen that, if down you can display a dirrent icon that when it up, ...
I'm wondering if this can be done in some kind of scale.
like when the value is 0 get a red smily
when it is between 1 and 50 give a green smily
when it is between 50 and 75 a yellow smily
when it is between 75 and 100 a red one again
(this is an example, i cant to do this with other ranges and more pics)
Thanks,
kyRoo |
You can do this two ways, depending on which version of weathermap you have.
In 0.91+, you can use 'inscalekey' to find which line in a scale the item hit.
| Code: |
SCALE goodbad 0 0 255 0 0
SCALE goodbad 0 50 0 255 0
SCALE goodbad 50 75 255 255 0
|
to define a scale with the bands you want to use.
(the colours here don't actually matter - if you don't want the label to change colour, set all the colours to white)
Then you can use
| Code: |
NODE blah
USESCALE goodbad
ICON images/status_{node:this:inscalekey}.png
|
Now, inscalekey contains a value like 0_0, 0_50, 50_75 (the top and bottom values of the scale line that was matched, with an _ in between). There's also a outscalekey. So you need icons called status_0_0.png etc.
In 0.95+, it's a bit nicer. There's a thing called a scale tag.
| Code: |
SCALE goodbad 0 0 255 0 0 images/redicon.png
SCALE goodbad 0 50 0 255 0 images/greenicon.png
SCALE goodbad 50 75 255 255 0 images/yellowicon.png
NODE blah
USESCALE goodbad
ICON {node:this:inscaletag}
|
You can use the tag for anything, not just icons. So if you wanted a comment to appear alongside only busy links, you could do that with this method too.
Hope that lot makes a bit of sense. It's a few steps, but especially in 0.95 it's fairly painless. |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|