11-26-2017 03:01
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-26-2017 03:01
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I wonder if someone can help, I have converted my meters into miles for my distance which works. On the console log it keeps saying truncating text as the conversion produces an equation with a few digits after the decimal point. The watch works fine as the truncating text is forcing a round up of the numbers due to my text length. Is there any code I could add to automatically force round up to as many digits as I want to display so I don't get the truncating message in the console log? (it just annoys me)
Thank in advance

11-26-2017 11:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


11-26-2017 11:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
It sounds like you're not setting text-length in your SVG.
Gondwana Software

11-26-2017 15:00 - edited 11-26-2017 15:14
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-26-2017 15:00 - edited 11-26-2017 15:14
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I've tried this. When the equation is worked out to miles(in the function) I end up with a number with about 6 digits (1.2435) for example. This is when using a text string of only 4, if I increase the text string number I get an even longer number. The only way to get the number down to 1.2 miles is to set the text length as 2, then I get the truncating message.
I would assume that when I do the equation in the function I need to add something which rounds it 2 digits, its this bit of code that i'm not sure about.
i've included the function code so I get a miles conversion,
function updateDistance() {
myDistance.text=(today.local.distance || 0)* 0.00062137;
console.log(today.adjusted.distance);
Please note: there are no actual issues with the miles distance shown on the watch, it works fine even with the truncating message on the console.

11-26-2017 17:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


11-26-2017 17:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Have a look at toFixed()
Gondwana Software

