0
votes

Change Chartjs financial chart yaxis from left to the right, tried this code but didnt work:

scales: { yAxes: [{ display: true, position: 'right' }] }

https://www.chartjs.org/chartjs-chart-financial/ enter image description here

2

2 Answers

1
votes

add position right to the first (default) yAxes object in the options

options: {
    scales: {
        yAxes: [{
        position: 'right'
      }]
    }
  }

EDIT: Seems like chartjs financial is working with v3 of the lib. In v3 you have to edit the axis in a different way:

options: {
  scales: {
    y: {
      position: "right"
    }
  }
}

enter image description here

0
votes
scales: {yAxes: [{
display: true,
position: 'right',
ticks: {
 beginAtZero: false,
 max: 2000,
 min: 1000,
 stepSize: 100
}}]}

scales: { yAxes: [{
display: true,
position: 'right',
ticks: {
 beginAtZero: true
},}]}

you can try these two ways, one of the them will work, depends on the your chart.