Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using "chart" and "type" attributes in canvas tag causes exception #52

Open
jstol opened this issue Aug 25, 2014 · 0 comments
Open

Using "chart" and "type" attributes in canvas tag causes exception #52

jstol opened this issue Aug 25, 2014 · 0 comments

Comments

@jstol
Copy link

jstol commented Aug 25, 2014

I'm seeing an issue where using the "type" attribute in a canvas tag to specify chart type seems to cause an exception to be thrown (TypeError: undefined is not a function). For example, doing something like

<canvas chart type="Line" ...></canvas>

rather than

<canvas linechart ...></canvas>

causes an exception to be thrown (at line 62 in angles.js).

...
chartCreated = chart[type]($scope.data, $scope.options);
...

If the type attribute is used to specify the chart type within a canvas tag, the type variable in angles.js appears to be undefined, so the function can't be called. Specifying the chart type in a canvas tag using an aliased type (ex. linechart) seems to work just fine, however.

Not 100% sure if the root of the problem lies within angles itself, or if it's an issue on my end. Just thought I would post my experience here to be safe.

jstol added a commit to jstol/angles that referenced this issue Sep 18, 2014
…xception and not reading in chart type

Originally, using the general "chart" directive (as opposed to a specific directive such as "linechart" or "barchart"), and the described "type" attribute caused an exception to be thrown (TypeError: undefined is not a function), and stopped the chart from being rendered at all. This was due to the fact that there was no "type" attribute defined in the directive's isolated scope. Looking at the code, it seemed as if though the chart type was expected to be specified in an attribute "chart", not an attribute "type". This "chart" attribute bound to the directive's isolated scope was changed to "type", and it no longer causes an exception to be thrown and allows the charts to be rendered as expected.

See issue gonewandering#52 (gonewandering#52) for the original reported issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant