Reputation: 113
I want to use Chartjs(chartjs.org) as my charting tool along with AngularJS using TypeScript. I have installed DefinitelyTyped for Chartjs from GitHub to incorporate creation of Chartjs charts in my TypeScript written controller. I can't find any related questions on doing this thing.
I just need to know how we populate data to our charts using DefinitelyTyped.
Upvotes: 12
Views: 54625
Reputation: 363
A bit outdated question, but had similar request since I'm working with Angular + PrimeNG (which uses chart.js
) with npm for packages.
Just install types from
npm i --save-dev @types/chart.js
and then use it for example:
import { Chart } from 'chart.js';
…
const myOptions: Chart.ChartOptions = {
title: {
display: true,
text: 'My title',
fontSize: 16,
},
};
Might help someone.
Upvotes: 5
Reputation: 275957
You can find example usages of chart.d.ts
in the form of a tests file right next to the definition in the DefinitelyTyped
repo.
Upvotes: 11