Chart.js: polymer integration error : Uncaught TypeError: (intermediate value).Line is not a function

Created on 20 Jan 2016  路  8Comments  路  Source: chartjs/Chart.js

in polymer i try

var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
    {
        label: "My First dataset",
        fillColor: "rgba(220,220,220,0.2)",
        strokeColor: "rgba(220,220,220,1)",
        pointColor: "rgba(220,220,220,1)",
        pointStrokeColor: "#fff",
        pointHighlightFill: "#fff",
        pointHighlightStroke: "rgba(220,220,220,1)",
        data: [65, 59, 80, 81, 56, 55, 40]
    },
    {
        label: "My Second dataset",
        fillColor: "rgba(151,187,205,0.2)",
        strokeColor: "rgba(151,187,205,1)",
        pointColor: "rgba(151,187,205,1)",
        pointStrokeColor: "#fff",
        pointHighlightFill: "#fff",
        pointHighlightStroke: "rgba(151,187,205,1)",
        data: [28, 48, 40, 19, 86, 27, 90]
    }
   ]
};
var ctx = this.$.mychart.getContext("2d")

//var ctx = this.getElementById("mychart").getContext("2d");
//d= document.createElement("canvas")

console.log(ctx)


var myLineChart = new Chart(ctx).Line(data);

i got this error
Uncaught TypeError: (intermediate value).Line is not a function

support

Most helpful comment

@luluprat the method of instantiating charts has changed in v2. You can find documentation at http://nnnick.github.io/Chart.js/docs-v2/

All 8 comments

@luluprat what version of Chart.js are you using?

I try 3 version with bower installation:
master
2 beta
2 dev

Might it be related to this?: http://stackoverflow.com/questions/23370269/jquery-autosize-plugin-error-intermediate-value-is-not-a-function

Missing semi colon on var "ctx = this.$.mychart.getContext("2d")" and "console.log(ctx)"

no thanks i get the same error with

<!doctype html>



<html>



Elements Test Runner

<script src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
<script src="bower_components/Chart.js/Chart.js"></script>

<canvas id="canvas" width="300" height="300"></canvas>

<script>
var data = {
    labels: ["January", "February", "March", "April", "May", "June", "July"],
    datasets: [
        {
            label: "My First dataset",
            fillColor: "rgba(220,220,220,0.2)",
            strokeColor: "rgba(220,220,220,1)",
            pointColor: "rgba(220,220,220,1)",
            pointStrokeColor: "#fff",
            pointHighlightFill: "#fff",
            pointHighlightStroke: "rgba(220,220,220,1)",
            data: [65, 59, 80, 81, 56, 55, 40]
        },
        {
            label: "My Second dataset",
            fillColor: "rgba(151,187,205,0.2)",
            strokeColor: "rgba(151,187,205,1)",
            pointColor: "rgba(151,187,205,1)",
            pointStrokeColor: "#fff",
            pointHighlightFill: "#fff",
            pointHighlightStroke: "rgba(151,187,205,1)",
            data: [28, 48, 40, 19, 86, 27, 90]
        }
    ]
};
var ctx = document.getElementById("canvas").getContext("2d");

//var ctx = this.getElementById("mychart").getContext("2d");
//d= document.createElement("canvas")

console.log(ctx);


var myLineChart = new Chart(ctx).Line(data);
</script>

@luluprat the method of instantiating charts has changed in v2. You can find documentation at http://nnnick.github.io/Chart.js/docs-v2/

Closing as resolved.

I think you guys should put all two versions documentations on the offical site, and give a hint for that. That would be user-friendly and helpful.

@JSoon there is an open issue to do that. Only @nnnick can update it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akashrajkn picture akashrajkn  路  3Comments

adriantombu picture adriantombu  路  3Comments

gabrieldesouza picture gabrieldesouza  路  3Comments

JewelsJLF picture JewelsJLF  路  3Comments

JAIOMP picture JAIOMP  路  3Comments