Problem with a callback in Chartjs with angular

Viewed 113

I am trying to format the y-axis, converting 1000 to 1K, however, I get the following error:

y: {
                title: {
                  display: true,
                  text: 'Total a pagar $'
                },
                ticks: {
                  callback: //here is the error
                  function(label: void) {
                    return label/1000+'k';//and here
                }
                },
                scaleLabel: {
                    display: true,
                    labelString: '1k = 1000'
                }
              }
            },

Error: src/app/new-chart/new-chart.component.ts:88:19 - error TS2322: Type '(this: Scale, value: string | number) => void' is not assignable to type '(this: Scale, tickValue: string | number, index: number, ticks: Tick[]) => string | number | null | undefined'. Type 'void' is not assignable to type 'string | number | null | undefined'.

88 callback:

If anyone can help me, thank u.

I'm working with angular and chartjs.

0 Answers
Related