[Chartjs]-Chart.js add border around line chart, and yAxis unit title ([s])

7👍

Adding one xAxes on top and one yAxes on right both showing nothing will do the job.

scales: {
        xAxes: [{
            /* Your xAxes options here */
        }, {
            position: 'top',
            ticks: {
                display: false
            },
            gridLines: {
                display: false,
                drawTicks: false
            }
        }],
        yAxes: [{
            /* Your yAxes options here */
        }, {
            position: 'right',
            ticks: {
                display: false
            },
            gridLines: {
                display: false,
                drawTicks: false
            }
        }]
    }

2👍

This is what worked for me.

scales: {
          xAxes: [
            {
             /* Your xAxes options here */
            },
            {
              position: 'top',
              ticks: {
                display: false
              },
              gridLines: {
                display: true,
                drawOnChartArea: false,
                drawTicks: false
              }
            }
          ],
          yAxes: [
            {
            /* Your yAxes options here */
            },
            {
              position: 'right',
              ticks: {
                display: false
              },
              gridLines: {
                display: true,
                drawOnChartArea: false,
                drawTicks: false
              }
            }
          ]
        }

Leave a comment