Emdee
Emdee

Reputation: 1701

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

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?

Upvotes: 8

Views: 13552

Answers (1)

olga
olga

Reputation: 320

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 ... }
]

Upvotes: 11

Related Questions