1

If we look at the ngx-charts line chart demo, we can see the y-axis displayed by default as:

enter image description here

Is there a way to invert the y-axis, so that it looks like this instead?

enter image description here

katyusha
  • 151
  • 1
  • 11

1 Answers1

0

There is a bit of a workaround for this:

If you multiplied all your values by -1 when setting the data, then in the label formatting multiplied them all by -1 again, the order would be reversed but the label would be unchanged.

So your data would be [-3000,-4000,-5000,-6000], putting them in the 'correct' order, then your formatting would be

  yAxisTickFormatting = (value) => {

return value * -1;

};

giving you the desired effect.

stackBlitz - https://stackblitz.com/edit/angular-simple-ngx-charts-emac6m?file=src/app/app.component.ts

Sam
  • 11
  • 2