Skip to content

Cannot read property 'options' of undefined #1505

Closed

Description

@joaocosta-azores

Hello.

I just tried creating a simple chart and i keep getting this problem:

"data is not defined" on main.js file
"Cannot read property 'options' of undefined " on chart.js file

I'm using the introduction example:

On the mains.js i have:

var ctx = document.getElementById("myChart").getContext("2d");
var myNewChart = new Chart(ctx).PolarArea(data);

What's wrong and why either options or data is always underfined.

Activity

  1. tiesont commented on Oct 1, 2015

    @tiesont
    Contributor

    A jsFiddle demonstrating the problem would be helpful. At a minimum, can you include how your data object is defined, and what order you are loading your scripts?

    This is also probably a better fit for StackOverflow, which definitely requires enough code to reproduce the problem.

  2. joaocosta-azores commented on Oct 2, 2015

    @joaocosta-azores
    Author

    That's the problem. I've tried defining options as shown in documentation without success. If someone could demonstrate first documentation example working on a jsfiddle would be helpfull.

  3. joaocosta-azores commented on Oct 2, 2015

    @joaocosta-azores
    Author

    v2.0.0-alpha4

    Probably it's the problem.

  4. tannerlinsley commented on Oct 2, 2015

    @tannerlinsley
    Contributor

    I think it would be best to produce a JSFiddle or codepen for your setup, and we'll take a look. I am currently using 2.0-alpha4 in production. It works great, and there are still some quirks to work out (you may have found one, who knows). Post the link here and we'll take a look!

  5. etimberg commented on Oct 2, 2015

    @etimberg
    Member

    @jonnydevv v2.x uses a different way of instantiating the chart. See the samples that @tannerlinsley linked on how to do it. It's different than v1.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions