Angular Charts with index / data labels that can be used to show additional information related to datapoint.
/* app.component.ts */ import { Component } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterOutlet } from '@angular/router'; import { CanvasJSAngularChartsModule } from '@canvasjs/angular-charts'; @Component({ selector: 'app-root', standalone: true, imports: [CommonModule, RouterOutlet, CanvasJSAngularChartsModule], templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { title = 'angular17ssrapp'; chartOptions = { title: { text: "Angular Column Chart with Index Labels" }, animationEnabled: true, axisY: { includeZero: true }, data: [{ type: "column", //change type to bar, line, area, pie, etc //indexLabel: "{y}", //Shows y value on all Data Points indexLabelFontColor: "#5A5757", dataPoints: [ { x: 10, y: 71 }, { x: 20, y: 55 }, { x: 30, y: 50 }, { x: 40, y: 65 }, { x: 50, y: 71 }, { x: 60, y: 92, indexLabel: "Highest\u2191" }, { x: 70, y: 68 }, { x: 80, y: 38, indexLabel: "Lowest\u2193" }, { x: 90, y: 54 }, { x: 100, y: 60 } ] }] } }
<div> <canvasjs-chart [options]="chartOptions" [styles]="{width: '100%', height:'360px'}"></canvasjs-chart> </div>
You can add indexlabel to particular datapoint by setting indexLabel property in datapoint level. Indexlabel can either be positioned inside or outside the datapoint in case of column, bar, pie, doughnut, funnel charts by setting indexLabelPlacement & can be rotated by setting indexLabelOrientation.
Note For step by step instructions, follow our Angular Integration Tutorial