Angularjs Simple Pie chart using JSON Example Step by Step

Angularjs Simple Pie chart using JSON Example Step by Step

In this Post We Will Explain About is Angularjs Simple Pie chart using JSON Example Step by Step With Example and Demo.

Welcome on infinityknow.com – Examples ,The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Example of PIE Chart in AngularJS Using ChartJS

In this post we will show you Best way to implement AngularJS Simple Chart, hear for How to Step by Step Way to Use chart.js with AngularJS with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

READ :  AngularJS Single page app with dynamic meta - AngularJS SEO

AngularJS Simple Chart Examples

Phase 1: Included simple all dependency external libs files of angular charts.
[php]
/angular/angular.min.js
/Chart.js/Chart.min.js
/angular-chart.js/dist/angular-chart.min.js

[/php]

Phase 2: create simple include module in angularjs module.
[php]
angular.module(“liveApp”, [“chart.js”])
[/php]

Phase 3: simple Include all the Data
[php]
$scope.chartLabels = [‘Products A’, ‘Products B’, ‘Products C’];
$scope.chartData = [125, 325, 210];
[/php]

Phase 4: Define Chart directory in HTML file and assigned model to it.
[php]

[/php]

How To get value of clicked slice in PIE chart
[php]
$scope.onClickSlice = function (points, evt) {
console.log(points);
};
[/php]

Include Scripts
[php]

var pieData = [
{
value: 65,
color:”#F7464A”,
highlight: “#FF5A5E”,
label: “Products A”
},
{
value: 59,
color: “#46BFBD”,
highlight: “#5AD3D1”,
label: “Products B”
},
{
value: 20,
color: “#FDB45C”,
highlight: “#FFC870”,
label: “Products C”
}
];
window.onload = function(){
var ctx = document.getElementById(“chart-area”).getContext(“2d”);
window.myPie = new Chart(ctx).Pie(pieData);
};

READ :  how to use flashdata in codeigniter?

[/php]

Example

I hope you have Got Simple charts in AngularJS apps with Chart.js And how it works.I would Like to have FeadBack From My Blog(infinityknow.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.

Leave a Comment