Table of Contents
Yes, you got that right. You can now create beautiful charts in AngularJS using our new directive. You can make use of all the stunning charts that we offer without dealing with core JavaScript. If you haven’t got it already, go ahead and download it for free from Angular charts page.
This one is easy. Everybody in the world, including us of course, loves Angular. Even Google Trends suggests that. See how that blue graph keeps going up?
So when developers, like you, came to us and asked for a solution, we decided to build Angular charts plugin. That’s how Angular-FusionCharts directive was born. Now that you know why we built it, let’s learn how to use it.<script type="text/javascript" src="/path/to/fusioncharts.js"></script> <script type="text/javascript" src="/path/to/angular.js"></script> <script type="text/javascript" src="/path/to/angular-fusioncharts.js"></script>
angular.module("myApp", ["ng-fusioncharts"])
<div ng-controller="MyController"> <div fusioncharts width="600" height="400" type="column2d" dataSource="{{myDataSource}}" > </div> </div>In the snippet above, it is assumed that the chart has to be added inside a controller calledMyController .
app.controller('MyController', function ($scope) { //Define the `myDataSource` scope variable. $scope.myDataSource = { chart: { caption: "Harry's SuperMart", subCaption: "Top 5 stores in last month by revenue", numberPrefix: "$", theme: "fint" }, data:[{ label: "Bakersfield Central", value: "880000" }, { label: "Garden Groove harbour", value: "730000" }, { label: "Los Angeles Topanga", value: "590000" }, { label: "Compton-Rancho Dom", value: "520000" }, { label: "Daly City Serramonte", value: "330000" }] }; });With the scope variable successfully initialized, this is how the result looks:
FusionCharts uses the JSON and XML data formats for writing chart data. As mentioned earlier, the chart data in the controller above is using the JSON data format. Every chart has a set of attributes and a predefined data structure, in both formats. To know about the attributes and data structure of a column 2D chart in JSON, click here. To know about the same representation of a column 2D chart in XML, click here.
In the above example, thefusioncharts directive is used as an attribute of the <div> element. Alternatively, thefusioncharts directive can be used as a tag. This is how the HTML code will then change:
<fusioncharts width="300" height="200" type="column2d", datasource="{{dataSource}}" ></fusioncharts>The complete guide to this directive can be found here. That’s all you need to know to start using our Angular-FusionCharts directive. We would love if you can give our directive a try. And if you are stuck anywhere drop us a line at support@fusioncharts.com. Happy to help!
We’re excited to announce the upcoming release of FusionCharts v4.1—a groundbreaking step forward in the…
Have you ever been overwhelmed by a massive data set and wondered, "How do I…
If you’ve ever tried to make sense of the stock market, you’ve probably come across…
Imagine you’re comparing the sales performance of your top product lines across different regions, or…
Have you ever spent hours buried in documentation, hunting for a specific piece of code?…
Do you feel like your data is a cryptic puzzle, locked away from revealing its…
View Comments
May I know where to download fusionchart.js?
I want to place it to the path for reference.
Thanks!
From here: https://www.fusioncharts.com/download/
How can it work with ionic mobile app
Your blog is very nice... Thanks for sharing your information...
Having read this I thought it was rather informative.
I appreciate you taking the time and effort to put this article together.
I once again find myself personally spending a lot of time both reading
and leaving comments. But so what, it was still worth
it!