Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show X axis on top and bottom in line chart rendered with Chart.js 2.4.0

Tags:

chart.js

I have a line chart rendered with Chart.js and I display the X axis at the bottom:

xAxes: [{  type: 'linear',
           position: 'bottom',

I would like to have two X axis, one at the bottom and one at the top. I see in the documentation that position is a string, thus one value only.

Is it possible to accomplish this?

like image 503
Emdee Avatar asked Dec 23 '16 10:12

Emdee


1 Answers

This is an old question, but I just had the same problem. Luckily the value of xAxes is an array, so you define multiple axes like this:

xAxes: [
    { position: 'top' },
    { position: 'bottom', ... other definitions here ... }
]
like image 56
olga Avatar answered Oct 17 '22 23:10

olga