Forum Discussion
SVG measure incorrect
Hello everyone,
I have an SVG of a battery. I want to show the percentage charged in a green color from the bottom, and the percentage remaining should have a white color.
Unfortunately, I have three issues:
1. the background color is is black, eventhough I the color code is #ffffff, so white.
2. the green color is filling up from the top instead from the bottom
3. the green color is not the percentage charged, but the remaining percentage. I already added (1-percentageArea) in the measure, but it doesn't make a difference
So, I don't understand what's going on. I can even delete the first SVG code with backgroundColor. It wouldn't make a difference, but this shouldn't be the case. I am really curious what's the issue and how this can be solved.
The code is as follows:
Anonymous Well, for starters, you can fix 2 of the problems by doing this:
<defs> <clipPath id='maskClip'> <rect x='-500' y='"&810 - (percentageArea) * 360&"' width='100' height='"&(percentageArea)* 360&"'/> </clipPath> </defs>
4 Replies
- Greg_DecklerCommunity Champion
Anonymous Well, for starters, you can fix 2 of the problems by doing this:
<defs> <clipPath id='maskClip'> <rect x='-500' y='"&810 - (percentageArea) * 360&"' width='100' height='"&(percentageArea)* 360&"'/> </clipPath> </defs>- AnonymousNot applicable
Great!! That works! How did you come up with the number 810?
- Greg_DecklerCommunity Champion
Anonymous Trial and error. Moved it down until it was almost gone and then moved it by 1 pixel at a time until it disappeared.
- tonny_bwgHelper I
could you please share the final codes ? I met the same issues :
1. the background color is is black, eventhough I the color code is #ffffff, so white.
Thanks--Tonny