Integrations available for frameworks and languages
Easily integrate ZingChart with your development stack.
Easily integrate ZingChart with your development stack.
Use the following code snippets to quickly get started with your framework. If you are having trouble, or don’t see your framework, please contact us directly through chat or email at support@zingsoft.com.
npm install zingchart
After downloading package locally, include the script using ES6 Modules:
import {zingchart, ZC} from './zingchart/es6.js'; // Modules must be imported EXPLICITLY when using es6 version import './zingchart/modules-es6/zingchart-pareto.min.js';
For quickest download, use the ZingChart CDN:
<script src="https://cdn.zingchart.com/zingchart.min.js"></script>
<div id="myChart"></div>
<!-- Just before the closing body tag is best --> <script src="https://cdn.zingchart.com/zingchart.min.js"></script> <script> zingchart.render({ id: 'myChart', data: { type: 'line', series: [ { values: [54,23,34,23,43] }, { values: [10,15,16,20,40] } ] } }); </script> </body>
npm install zingchart-react
import 'zingchart/es6'; import ZingChart from 'zingchart-react'; class App extends Component { ... }
class App extends Component { constructor(props) { super(props); this.state = { config: { type: 'bar', series: [{ values: [4,5,3,4,5,3,5,4,11] }] } } } ... }
class App extends Component { ... render() { return ( <div> <ZingChart data={this.state.config}/> </div> ); } ...
npm install zingchart-angular
import { ZingchartAngularModule } from 'zingchart-angular'; @NgModule({ imports: [ ... ZingchartAngularModule, ], })
config:zingchart.graphset = { type: 'line', series: [{ values: [3,6,4,6,4,6,4,6] }], };
<zingchart-angular [config]="config" [height]="500"></zingchart-angular>
npm install zingchart-vue
import 'zingchart/es6'; import Vue from 'vue'; import zingchartVue from 'zingchart-vue'; Vue.component('zingchart', zingchartVue);
<zingchart :data="myConfig" :height="300" :width="600"/>
export default { data() { return { type: 'line', series: [{ values: [43,23,54,54,39,47,38,59,39,49] }] } } }
npm install zingchart-web-component
OR Manually import each chart and register it as a web componentimport ZingChart from 'zingchart-web-component'; customElements.define('zing-chart', ZingChart);
import {Line} from 'zingchart-web-component/charts/ZCLine.js'; customElements.define('zc-line', Line);
Or While everything can be configured via the data property, you can also fully configure ZingChart via child components<zing-chart data='{"type": "line", "series": {["values": 1,2,3,4,5,6,4]}}'> </zing-chart>
<zc-line> <zc-legend draggable></zc-legend> <zc-series> <zc-series-0 values="[3,4,3,2,4,3,3]"></zc-series-0> </zc-series> </zc-line>
npm install zingchart-angularjs
angular.module('myApp', ['zingchart-angularjs']);
$scope.myJson = { type: 'line', series: [ { values: [54,23,34,23,43] }, { values: [10,15,16,20,40] } ] };
<zingchart id="myChart" data-zc-json="myJson" data-zc-height=500 data-zc-width=600></zingchart>
composer require zingchart/php_wrapper
require __DIR__ . '/vendor/autoload.php;
$zc = new ZC("myChart"); $zc->setChartType("bar"); $zc->setSeriesData([1,4,2,6,3]); $zc->render();
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> <script src="https://cdn.zingchart.com/zingchart.min.js"></script> <script src="https://cdn.zingchart.com/zingchart.jquery.min.js"></script>
<div>
with an ID
<div id="myChart"></div>
$(document).ready()
function
$(document).ready(function() { $('#myChart').zingchart({ data: { type: 'line', series: [{ values: [1,2,5,3,9,4] }] } }); });
npm install zingchart-svelte
import 'zingchart/es6'; import ZingChart from 'zingchart-svelte';
const config = { type: 'bar', series: [ { values: [4,5,3,4,5,3,5,4,11] } ] }
<ZingChart data={config} />