Skip to content

Embedding Formatted Numbers from 'vars' Variable in Legend Text #409

Answered by dbuezas
kaijk asked this question in Q&A
Discussion options

You must be logged in to vote

Oh, it's probably a string then. You'd have to cast it to a number before using toFixed.
parseFloat(vars.windSpeeds.slice(-1)).toFixed(1)

What you did is equivalent so the best solution is the one you like the most :)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@kaijk
Comment options

@dbuezas
Comment options

Answer selected by kaijk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants