I want to draw Pie chart using Chart.js 2.1.6
My code :
<script src="~/Plugin/Chart.js 2.1.6/dist/Chart.min.js"></script>
<canvas id="mychart"></canvas>
var data = [
{
value: 300,
color: "#F7464A",
highlight: "#FF5A5E",
label: "Red"
},
{
value: 50,
color: "#46BFBD",
highlight: "#5AD3D1",
label: "Green"
},
{
value: 100,
color: "#FDB45C",
highlight: "#FFC870",
label: "Yellow"
}
]
var ctx = $("#myChart").get(0).getContext("2d");
var myPieChart = new Chart(ctx).Pie(data);
But i get an Error:
Uncaught TypeError: (intermediate value).Pie is not a function.
I want to draw Pie chart using Chart.js 2.1.6
My code :
<script src="~/Plugin/Chart.js 2.1.6/dist/Chart.min.js"></script>
<canvas id="mychart"></canvas>
var data = [
{
value: 300,
color: "#F7464A",
highlight: "#FF5A5E",
label: "Red"
},
{
value: 50,
color: "#46BFBD",
highlight: "#5AD3D1",
label: "Green"
},
{
value: 100,
color: "#FDB45C",
highlight: "#FFC870",
label: "Yellow"
}
]
var ctx = $("#myChart").get(0).getContext("2d");
var myPieChart = new Chart(ctx).Pie(data);
But i get an Error:
Share edited Jul 5, 2016 at 3:19 Andrei Zhytkevich 8,0992 gold badges32 silver badges45 bronze badges asked Jul 5, 2016 at 0:48 Black JohnBlack John 471 gold badge1 silver badge4 bronze badgesUncaught TypeError: (intermediate value).Pie is not a function.
1 Answer
Reset to default 7have you tried using the following code instead?
var myPieChart = new Chart(ctx,{
type: 'pie',
data: data,
options: options
});