You can view the full component on GitHub.
Render AngularJs charts simply by adding a ZingChart configuration object as a scope variable.
Charts can be extensively customized with the ZingChart library.
Utilize the power of AngularJS by allowing the directive to watch for changes to the configuration and the values of the chart, and dynamically update.
The directive is simply a wrapper around ZingChart allowing users to have full capabilities of the library.
Maps can easily be rendered utilizing the ZingChart library
Allow ZingChart to resize dynamically to the full width and height of its parent. Drag the bottom right hand corner to see the responsiveness.
Fetch new data using AJAX, change the scope variable, and automatically update the chart!
Simple to use AngularJS's directive syntax is available as either:
An element: <zingchart></zingchart>
OR
An attribute: <div zingchart></div>
For basic charts, just add data!
The directive simply adds dynamic data-binding to your configuration object and/or data. No extra syntax, only the ZingChart syntax you know and love. This allows users to access all features provided by the main ZingChart library
Utilize AngularJS's two-way data-binding by allowing this directive to watch for changes. The directive can be set up to watch for the chart's data values, or even chart configuration attributes.
Include the following dependencies into your HTML file
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script> <script src="http://cdn.zingchart.com/zingchart.min.js"></script> <script src="http://cdn.zingchart.com/angular/zingchart-angularjs.js"></script>
Inject the directive into your application
angular.module('myApp', [ 'zingchart-angularjs' ]);
Insert the ZingChart-AngularJS directive into your HTML
<zingchart id="myChart" zc-json="myJson" zc-height="500" zc-width="600"></zingchart>
Configure your chart through a scope variable
... $scope.myJson = { type: 'line', series : [ { values: [54,23,34,23,43] }, { values: [10,15,16,20,40] } ] }; ...
Try!
Adding your license key to your AngularJS application is slightly different than with the standard ZingChart library.
In your template, add zc-license="zcLicense"
. Then, in your script, add your license key.
<div ng-controller="MainController"> <zingchart id="chart-1" zc-values="myValues" zc-json="myObj" zc-license="zcLicense"></zingchart> </div>
app.controller('MainController', function ($scope) { $scope.zcLicense = ['<your license here>'];
Need to squeeze out performance? Want to learn more about its other features?
To read more about ZingChart and AngularJS, check out our GitHub and View our Blog Post.