01-09-2021 04:55 - edited 01-09-2021 08:26
01-09-2021 04:55 - edited 01-09-2021 08:26
**EDIT - Fixed it so no responses needed**
Hi all
I have a question on progress bar for steps please...
I have this in my index.js
import {today, goals} from "user-activity";
import { me as device } from "device";
import document from "document";
const deviceWidth = device.screen.width;
const stepGoalPercentage = (userActivity.today.adjusted["steps"] || 0) * 100 / goals.steps;
stepsbar.width = (stepGoalPercentage / 100) * deviceWidth;
const stepsbar = document.getElementById("stepsbar");
and this in my index.gui
<rect id="stepsbar" width="150" height="20%" x="0" y="80%" fill="maroon"/>
However when trying to build there is an error "Unhandled exception: ReferenceError: userActivity is not defined".
I'm not sure if there is a step goal in the simulator so is there a way to force/pretend a goals.steps
Thank you for any help.
**EDIT - Fixed it so no responses needed**
Best Answer01-11-2021 02:04
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
01-11-2021 02:04
Yeah, you imported `today`, you can just reference the user activity API from that imported variable. e.g. `today.adjusted.steps`
Best Answer