Closed agoransson closed 9 years ago
Actually testing all of the demo.html charts I also find the same problem in the radar and bar charts.
Uncaught TypeError: Cannot read property 'forEach' of undefined
(anonymous function) @ chart-radar.html:63
(anonymous function) @ polymer.js:8988
chart-radar.html:63
Uncaught TypeError: Cannot read property 'forEach' of undefined
(anonymous function) @ chart-line.html:65
(anonymous function) @ polymer.js:8988
chart-line.html:65
Uncaught TypeError: Cannot read property 'forEach' of undefined
(anonymous function) @ chart-bar.html:65
(anonymous function) @ polymer.js:8988
chart-bar.html:65
I am having exactly the same problem. Is it because of this error the graph will not display?
I'm actually thinking this has something to do with Polymer rather than these elements. I've seen similar errors with other third-party elements, all fail on handling the arrays.
I'm not sure where in the source yet but I've been able to isolate this to the values attribute if there is only one index. To make your example work, @agoransson, adjust your values attribute to the following values="[[10,14,20,25,13,9,40], []]"
so that there's another index present.
@robdodson Polymer is not set up to handle multidimensional arrays, in order to overcome I recommend having each index as a string and parse each index during the forEach.
index.html
<chart-element values="['[65,59,90,81,56,55,40]']"> </chart-element>
in updateChart()
data: JSON.parse(this.values[i])
may need to throw in a try catch.
Actually I got this to work
what you had is values="[[10,14,20,25,13,9,40]]"
instead of putting the single quotes i added spaces between the 2 array brackets and it worked
values="[ [10,14,20,25,13,9,40] ]"
I've updated the API for the latest release. You now need to pass a data object, similar to the one Chart.js requires. I'd recommend doing this through a binding of some kind. I'm going to close this issue since it no longer matches the new API
Using the demo code for chart-line I get the above mentioned error on line 65 of
chart-lines.html
. It doesn't seem to like the array.Here's the error copied from console.
This is the example code I'm using in my layout.
I've been trying to decode this problem myself but can't find the reason why this chart isn't working. Would love some help.
These are the installed components:
Thanks.