Can someone help me with formulas for progress bars?

Hi all!

Can someone help me with progress bars to display heart rate and calories burnt?

For the numbers displayed, I am using the following formulas:
Calories: (round((#ZSC#/20)))
Heart Rate: #ZHR#
Steps: #ZSC#

The screenshot below shows how I want them to be displayed. The steps one is already done, using the formula: ((clamp(#ZSC#, 0, 10000)/10000)*.843)

If someone could help me with the heart rate and calories ones, that would so helpful!

3 Likes

Welcome @hello-kurious-katie

Yeah nice those progress bars with a Space for the Icon. You are so very nearly there .

So you understand that the number 10000 is the max number of steps you want to record on your gauge .
So you could substitute that for 200 in the case of the BPM. I would let it go from Zero. You understand that the first number 0 in you Clamp Expressoon is the minimum so you could have it starting at 50. But that would mean your mid range was 75 which low. You will have to play with that. Sports Men and Women have a very low resting Heart Rate.

I would say 2000 is a good max for your Steps Calories . Remember some Counters show resting Calories as well so. I think you formula for Calories gives you 2000 with 10000 steps. I will have to check.

Please get back if this make no sense and I can send you stuff from my Laptop.

1 Like

Hi :slight_smile:

Thanks so much for taking the time to go over that for me!
Would you be able to help me in writing the formulas? It’s the calorie one in particular that I am struggling to write in this style.

2 Likes

I’ve done some like you are working on. They are of course different, but the basic style of expression will get you moving forward. MAG 1801 has steps and heart rate with an icon breaking the progress circle. Inspection is open so you can go under the hood and see how it’s written.

For the calories I use ((round((#ZSC#/40)))/360) and all you would need to do is figure out how many degrees of movement you are using and change the 360 to that number of degrees. Then it’s all setting up the rotation box with a degree where it looks good to you.

3 Likes

Yeah it is tricky at the beginning. I am in the Garage servicing our Bush Trimmer at the moment. I will be in soon.

You see the Tag for steps in your formula that works. You just put the one you have for calories in its place. Change both the 10000 to 2000. I know I can make it sound simple . I am one of those who knows what kind of pickle we can get into. By the time I get in I bet one of the Masters has cracked it for you. Other than that Stand By.

So I made a mistake . I can only show you the Structure of the code . I have no way to check the conversion quickly . 2000m calories is per day for an old Person like me . I think 10000 steps burns 500 Calories . It depends so much on your biometrics .

so this works . Might need some tweaking . of course you have to rotate it to the start position but you know how to do that .

((clamp((round((#ZSC#/20))),0, 500)/500)*.843)

I told you Someone else would join in . The MAGic method is one of the others . and you work from the angle you want to fill which is the same as your *.843 .
Note the MAG formula shows a different fill angle .
To explain the formula you showed me reduces all the variables to s number between 0 and 1 then you multiply that by your magic number and that gives you the fill number between 0 and 1 .

So now we have a discussion about the conversion Number ( Biometric ) .

Let me know if you are stuck with the heart .
Facer Invite us to make a commitment to the Community . The General Ethos is to help people as much as they need but not to do the job for them . I am certain you can get your Heart going yourself . So much more satisfying than Copy and Pasting your Education . I learnt very little till I forced myself to remember some stuff .

Any way I make it .8333
So I see the rotation angle as 30 degrees because that is me . Love 30, degrees .
That is 60 degrees inclusive gap for the Icon .
360 degrees total rotation minus 60 = 300
300/360=0.833

We have a Master who writes his code de in an explanatory way .
Peter would have given you .

((clamp((round((#ZSC#/20))),0, 500)/500)*(300/360))

I am not sure if round is necessary I will check .

((clamp((#ZSC#/20),0, 500)/500)*(300/360))

Works perfect .

Please Note the Formulas above are Format Protected By ’ ’ make sure you remove them if you copy them or the code will not work .

Lots to learn.

Shall I go on ??

1 Like

I think I have a solution that is not complicated, less math more playing around:

step 1
Heart rate, this is Fill Ratio formula for full progress circle:
(clamp(#ZHR#, 0, 200)/200)

if you want half of circle use:
(clamp(#ZHR#, 0, 200)/400)

OK, so the key number is /200 and /400. Change it until you get want you want.

Set opacity to 100%, background opacity to 0.
*
*
*
step 2
Now you have a progress bar but you don’t have background, we set it to 0.

Duplicate progress bar we just made and in Fill Ratio field enter
1 for full circle
0.5 for half circle
0.666 for two thirds of circle

Change it until you get what you want.

Set Opacity to 50% and now we have a background for progress bar you made earlier.

Of course, place the background under the progress bar.

Same goes for making any progress bar.
*
*
*
*

Walk calories, full circle progress bar:
((clamp((#ZSC#/20), 0, 500)/500))

half circle progress bar:
((clamp((#ZSC#/20), 0, 500)/500)/2)

again, change /X until you get what you want.

Let me know if I didn’t make it clear.

3 Likes

@masterboyhr came up with the best formula HERE which was this -
(round((((#DH#*60)+#DUm#)*1.23)+(#ZSC#/20)))
Ha ha, and there he is, just pipped me to the post :laughing:

2 Likes

LOL

well, we have to help.

1 Like

And for walked calories 500 goal is more than enough, today I walked 5.83 km and spent 378 calories. Kudos to anyone who can spend 2000 cal per day by walking!

1 Like

Ahhh . The Cavalry Has arrived .
@masterboyhr The 2000 Calories per day is including Life / Resting Calories .
I estimate 1800 for myself because I am getting very Old .

1 Like

I agree, 2000 is good goal for total calories.

But it’s much more complicated to calculate it, as icrltd4 said,
math is more complicated, I don’t want to go there at this point, it’s combination of time, calories and walking.
And other sports as well. Unfortunately we cannot get data from other sports or activites.

1 Like

Yeah . Exactly . We do not want to start arguing with the Rowers and Swimmers . My Daughter has a Skull :rowing_woman: and she uses Garmin and Strava to log her Activity . If I was that seriously into a Sport I would not rely on Facer Data . I find the Data I get on the Native Samsung stuff is really quite good . I have logged a swim with it but it made a new log at every turn .

1 Like

I THINK I’ve managed it!

Anyone want to check and see if this is correct?

3 Likes

I seriously think we are wasting our time here .

You have not multiplied by .833 so your Bars are running over you Icon .
In your case .85 since you are on a 54 degree inclusive .
Rotated by 25 .
I would go symmetric if I were you 25 for 50 inclusive wil give you a factor of .86111

I did post code here that worked perfectly .

It seems you are not learning despite the best Advice .

If there is something wrong with the Help you are being give n let us Know .

((clamp(#ZSC#,0,10000)/10000)*.8333)

Your temperature shows C for Imperial and Metric . The default weather Tag changes automatically . #WCT#°#WM#

You might want to get into 12 / 24 hrs .

Apart from that Nice colour Good font .

I’m so sorry that you feel you are wasting your time :frowning: To me, you guys are helping! I am just a really slow learner (and struggle more-so reading things, than seeing/doing)
I’m extremely new to this, and I tried to copy/pasting the code, but nothing appeared. Tried again copy/pasting from the quote as you mentioned (without the ’ ').

I had just tweaked until I thought it was working :frowning:

My apologies about the weather (oversight as I was extremely tired), I’ve fixed that now :slight_smile:

I will try to copy the code you have pasted in your latest comment today once I get to my desk (hopefully can fix it).
Can you let me know if all 3 progress bars are wrong? If so, could you let me know exactly what to replace the code with?

1 Like

Yes they are all wrong.

I am sorry I was so Tired Yesterday from Bush Trimming .

I did outline what you have to do . But all I can do is Make a Test For you .

Which time Zone are you in .

Stand By .

Ah right, no problem! I was extremely tired too (still am), haha! Early mornings and late nights are wrecking havoc on my brain, haha!

Sorry again that I couldn’t follow your kind instructions - if you could explain things in layman’s terms, or ideally share the exact code to copy/paste, I would be super grateful!

I’m in the UK, so my timezone is GMT+1 at present :slight_smile:

1 Like

Yeah . Cool . In the UK too. I will say Sorry Again . I forgot myself the questions I asked at the beginning . I think for now it is better to show you a working model . If you want to change angles etc it will be later . We are cutting the Grass today .

The trouble with exact Copy and Paste on here is code gest changed by the Internet. So we Protect it with the ’ ’ but if you paste them the code will not run .

I Presume you know how to get to the sliders to test your code. Get back quick if you don’t . It is impossible to do this stuff without the Sliders .

2 Likes

russellcresser that’s the spirit!! :wink:

1 Like

Just want to add (I cannot know if hello-kurious-katie knows that):

hello-kurious-katie: click on the watchface russellcresser posted and then click on the rocket on the left, it will open the inspector mode.
You will be able to see how the watchface was made, you can change everything but you cannot save the changes.
So if you mess it up just close it and open it again.

2 Likes