How to set the vertical-axie in ionic with chart.js static?


#1

Ionic Framework: 3.3.0
ng2-charts: 1.6.0

I have a problem with my Code in Ionic. It’s works but you see on the picture the problem: the scala of the y-axis is dynamic. how could I do it static (like from 60 to 140). (see red circle in the picture)

My code: home.ts

import { BaseChartDirective } from 'ng2-charts';
...
export class HomePage {
...
//the label and the data will be created dynamicly
lineChartHeartRateLabel: string[] = ["xx:xx:xx", "xx:xx:xx", "xx:xx:xx", "xx:xx:xx"];
lineChartHeartRateData:number[] = [88, 90, 92, 90];
lineChartHeartRateType: string = 'line';
...

My code: home.html

<div style="display:block;">
  <canvas baseChart
    [data]='lineChartHeartRateData'
    [labels]='lineChartHeartRateLabel'
    [chartType]='lineChartHeartRateType'
   >
   </canvas>

Like you see on the picture, the line chart works. But I want the axis static. Could anybody tell me how I could do that?

Thanks and best regards.