<ltng:require scripts="{!$Resource.chartJS}" afterScriptsLoaded="{!c.setup}"/>
<canvas aura:id="chart" id="myChart" width="400" height="400"/>
({
setup : function(component, event, helper) {
var data = {
labels: ["January", "February", "March"],
datasets: [{
data: [65, 59, 80, 81, 56, 55, 40]
}]
};
var el = component.find("chart").getElement();
var ctx = el.getContext("2d");
var myNewChart = new Chart(ctx).Line(data);
}
})
When I am using this code in lightning component facing error. Error Message. Uncaught Action failed: c:XXXXXXXX$controller$setup [(intermediate value).Line is not a function]
Please help anyone fix this bug. Simply I did copy and paste from https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_libs_platform.htm this.Also in static resource Chart.js file uploaded.