08-20-2020 08:49
08-20-2020 08:49
I got an email from a customer in Denmark who is having issues with the statistic arc calculations.
Apparently in Denmark, commas are used like periods in the US, so ten thousand is written 10.000 instead of 10,000. The same for decimals so 1.5 in the US would be 1,5 in Denmark.
Here is my code used to calculate the steps and arc.
//********** CALCULATE STEPS **********\\
let localSteps = (today.adjusted.steps.toLocaleString() || 0);
var steps = document.getElementById("steps");
steps.text = (localSteps);
//********** CALCULATE STEPS ARC **********\\
let stepsCalc = (Math.floor((today.local.steps/goals.steps) * 310));
var stepsArc = document.getElementById("stepsArc");
if (stepsCalc > 310) {
stepsArc.sweepAngle = 310;
} else {
stepsArc.sweepAngle = stepsCalc;
}
The customer had a step goal of 6000 and had 4100 steps for the day, but instead of the arc being at 2/3 it was just barely showing at all.
I have verified that the today.adjusted.steps and the today.local.steps are both raw numbers and no commas in the calculation.
Has anyone else seen this?
09-02-2020 07:39
09-02-2020 07:39
It looks sane to me. Was the text field showing the correct value, but the arc was flat?
Is there a reason you're using adjusted for the text and local for the arc?
Perhaps add a permissions check to ensure they've actually granted access to user activity data?
09-02-2020 09:55 - edited 09-02-2020 09:55
09-02-2020 09:55 - edited 09-02-2020 09:55
Here is the screenshot sent to me. The text field is correct and you can see that the arc is starting. The step goal is 6000. If you do the math with the 4,103 as 4.1 the arc display would be correct. However the data used is raw data. No reason to use the adjusted. Just something that perpetuated and has been overlooked. 🙂
09-08-2020 14:24
09-08-2020 14:24
Math is universal. Never seen this before. I think (like Jon) it’s to do with permissions.
What clockface are you talking about?
do you use locale ?
09-09-2020 07:54
09-09-2020 07:54
I would assume that math is universal also. I am having them toggle all the permissions, however I would challenge that because the stats are all being collected which would not happen if they didn't have permission.
The clockface in question is Easy Read 101, however I have had this person download others and got the same result.
09-09-2020 14:16
09-09-2020 14:16
I’m going to test it.
First impression: a very good looking clockface. Nice work!
no fault in the arc, no fault in the numbers (12.367 of 11.000).
Yes, dot for thousands, komma for decimals.
Oeps, komma for thousands, location is set to USA.
Back to Danmark.
more next time.
09-10-2020 11:12 - edited 09-10-2020 15:31
09-10-2020 11:12 - edited 09-10-2020 15:31
I do see a difference in the format on page 2.
in (nl-NL) I see no difference between decimal point and 1000 point
The arcs are still ok.
02-17-2021 08:32
02-17-2021 08:32
The formula is excellent
07-23-2021
02:35
- last edited on
12-14-2021
21:15
by
YojanaFitbit
07-23-2021
02:35
- last edited on
12-14-2021
21:15
by
YojanaFitbit
I got an email from a customer in Denmark who is having issues with the statistic arc calculations.
Apparently in Denmark, commas are used like periods in the US, so ten thousand is written 10.000 instead of 10,000. The same for decimals so 1.5 in the US would be 1,5 in Denmark.
Here is my code used to calculate the steps and arc.
//********** CALCULATE STEPS **********\\
let localSteps = (today.adjusted.steps.toLocaleString() || 0);
var steps = document.getElementById("steps");
steps.text = (localSteps);
//********** CALCULATE STEPS ARC **********\\
let stepsCalc = (Math.floor((today.local.steps/goals.steps) * 310));
var stepsArc = document.getElementById("stepsArc");
if (stepsCalc > 310) {
stepsArc.sweepAngle = 310;
} else {
stepsArc.sweepAngle = stepsCalc;
}
The customer had a step goal of 6000 and had 4100 steps for the day, but instead of the arc being at 2/3 it was just barely showing at all.
I saw some solutions to this problem on the site where the specialists who work there showed me a partial solution to this problem. When it comes to statistics and performing tasks on statistics, I always turn to this resource.
I have verified that the today.adjusted.steps and the today.local.steps are both raw numbers and no commas in the calculation.
Has anyone else seen this?