I have a bar chart with below code...works brilliantly....except its missing a title.
Does ng2-charts have a title option in API? eg 'sales chart'. The values are pulled from the typescript file.
<div>
  <div style="display: block">
    <canvas baseChart
            [datasets]="barChartData"
            [labels]="barChartLabels"
            [options]="barChartOptions"
            [legend]="barChartLegend"
            [chartType]="barChartType"
            (chartHover)="chartHovered($event)"
            (chartClick)="chartClicked($event)"></canvas>
  </div>
You can specify it as part of the chart options, e.g.
  private barChartOptions = {
    title: {
      text: 'my title',
      display: true
    }
  };
You can specify additional properties for font size etc, see the docs at: http://www.chartjs.org/docs/latest/configuration/title.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With