Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

Using global variables as chart data values

Open mattriddle opened this issue 13 years ago • 4 comments

It seems to have an issue when I use global variables instead of numbers in the chart data values, even with the variable is a number.

mattriddle avatar Jun 20 '13 01:06 mattriddle

I am having the same issue. How can I pass in a variable to the value field? I want to do value: someVariable instead of just value: 7

neuquen avatar Dec 15 '13 03:12 neuquen

Try "value : 1*someVariable"

I couldn't reproduce your issue...except if the variable is not a numeric variable.

FVANCOP avatar Dec 15 '13 10:12 FVANCOP

Woops, coder error. I realized that even though it was a "number", it was actually a string. So I was passing in someVariable = "7" instead of someVariable = 7. I used Number(someVariable) to convert it rather than 1*someVariable but thanks for the suggestion!

neuquen avatar Dec 17 '13 01:12 neuquen

Recommending to close this issue

fulldecent avatar Sep 15 '14 16:09 fulldecent