@optalitix/chartjs-angular-wrapper
v1.0.0
Published
This library provides an easy plug-and-play option for rendering charts. It is based on `chart.js`.
Downloads
138
Keywords
Readme
Chart.js Angular Package for Optalitix Products
This library provides an easy plug-and-play option for rendering charts. It is based on chart.js
.
Installing
Run npm i @optalitix/chartjs-angular-wrapper
. Thereafter, import the ChartjsAngularWrapperModule
to your app.module.ts
Usage
Add the following tag to wherever you want the chart to be drawn:
<chartjs-wrapper [chartData]="<outputChartDefinition>"></chartjs-wrapper>
where the ChartData must conform to the model:
export class OutputChartDefinition {
public id:string;
public address: string;
public name?: string;
public title?: string;
public type: ChartType;
public chartData: ChartData;
public chartMetadata?: ChartMetadata;
}
export class ChartMetadata {
public xTitle?: string;
public yTitle?: string;
public multipleAxes?: boolean;
public horizontalLines?: boolean;
}
export class ChartData {
public xValues: Array<string>;
public datasets: Array<DataSet>;
}
export class DataSet {
public seriesName: string;
public yValues: Array<string>;
}
export class ChartCoordinates {
public x: string;
public y: string;
}