How to design performance meter

Hi , am trying to figure out on how to design a component , which shows performance meter based on value given. The meter color goes with gradient . please guide me !
No description
17 Replies
MarkBoots
MarkBoots14mo ago
"easiest" way here is a svg that has a layer with the full colored gradient already in it with a mask that shows a part of it. depending on what the actual thing looks like, you can maybe do it with css to set the value, but maybe you'll need js. it is possible to do the whole thing in css, but based on this design, that's a lot of elements
Zoë
Zoë14mo ago
The meter color goes with gradient
I’m not understanding what your actual goal is. I understand that something spins but could you give a screenshot of the expected appearance? If it’s just blocks you can just select each block and recolour them. I would expect a needle type thing but the middle is covered and it might look a bit weird. Just not sure what you want the end result to look like
RaviTeja
RaviTejaOP14mo ago
Am trying to achieve something like this, except the color orange in my requirement is a gradient which differs on value. please let me know know if it still not understandable.
No description
RaviTeja
RaviTejaOP14mo ago
Just for reference , not my expected output
MarkBoots
MarkBoots14mo ago
would be nice to know the expected output. because there are different approaches for example, i've made this a while ago https://codepen.io/MarkBoots/pen/mdjgzmz
missymae
missymae14mo ago
If you are using a component library, you might have something like https://chakra-ui.com/docs/components/circular-progress . In that case, you can set a style property with a css gradient, maybe. In Chakra, there is a .track and .filledTrack property.
Chakra UI: Simple, Modular and Accessible UI Components for your React Applications.
Circular Progress
Circular Progress is used to indicates the progress for determinate and indeterminate processes.
missymae
missymae14mo ago
For something that fits your images though, I agree maybe you'll need to make some SVG template
ἔρως
ἔρως14mo ago
i have an idea so horrible that it might just work it is very complicated, but oh well the idea is to use a ::before with the orange color, and an ::after wait, nevermind, just implement it in svg
ἔρως
ἔρως14mo ago
if you want a less interesting version of that, you can do something like the screenshot
No description
ἔρως
ἔρως14mo ago
you might be able to implement this, without rounded edges, with some tricks and yes, im not good at math
MarkBoots
MarkBoots14mo ago
Before creating one, i've checked codepen. And look at that: https://codepen.io/yichinweng/pen/WNvXevO
ἔρως
ἔρως14mo ago
interesting
Zoë
Zoë14mo ago
(I know it's not your pen) Also worth noting rather than hard coding 198 you can select the path element and do getTotalLength() document.getElementById('blue').getTotalLength() (the length is actually 197.32334899902344)
glutonium
glutonium14mo ago
ig try using conical gradient
ἔρως
ἔρως14mo ago
if i were you, i would try to end the conical gradient on a floating number, instead of an integer if you end in an integer, it creates this weird aliased effect if the value is equal or higher than 1, i recommend subtracting 0.001 from the value also, it avoids issues where the whole thing collapses when you hit 360deg
glutonium
glutonium14mo ago
hmm understandable tnx
Want results from more Discord servers?
Add your server