Search code examples
javascriptchart.jsfinance

Change Chartjs financial chart yaxis from left to right


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


Solution

  • 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