I would like to change the color of a progress bar by range. for example, from 0% to 30% the color is green, from 31% to 75% the color of the progress bar changes to yellow and then from 76% to 100% the color has to be red.
What properti would work for this?
If you want to be really cool then add some CSS transition settings. (The animated GIF below doesn't quite do it justice.)
Figure 1. The transition effect.
Figure 2. The settings. This might not work. See the update on post #15.
transform 0.5s linear gives the smooth, slightly delayed motion. background-color 2s ease gives the fade from one color to another.
Adjust the timings to suit.
These are CSS properties and there are many tutorials on the web. You can start at W3Schools.
Yes, you can have either a tag binding or a property binding. Selecting one disables the other.
As you have probably discovered, you needed to apply the map transform to the tag binding.
Yes you're right, under the style it works, thanks for the help.
I wonder if should be possible to change the color in a different way, I mean now it actually changes smooth but from a color to another one (for example from red to yellow..
How can I make the color transition linearly, for example, during the change from green to yellow with all the shades between?
I think you mean having the color property change linearly with value? (This is different to a CSS transition between two distinct states.) Is that correct?
Yes I'm sorry for the bad explanation.. I should rappresent a production percentage, 100% green, 90% red.. In the middle should be nice that the color changes dynamically with all the small variation of the percentage.
As you said is not only an on/off change when the value is reached.
You can do that easily enough with the Map Transform. You'll need a line for 0 - 90, 90 - 91, 91 - 92, etc. Pay particular attention to how the ( ) and [ ] and ( ] and [ ) works.
You'll need to get the hex values for each of the colors. (It would be very handy if Perspective supported HSL color formats as you could bind the hue to your value and run with a fixed saturation and lightness.) There are many, many tools on the web for this. Here's one: WorkWithColor color blender although it only gives eight steps.