user1472672
user1472672

Reputation: 365

Draw tick lines at the top of highcharts chart

Is it possible to also draw tick lines along the top of the chart using highcharts for the x-axis? I have seen the opposite attribute:

But this inverts the x-axis ticks and labels. I simply wanted to also include some tick marks along the top for the x-axis as well. This is very typical in scientific plots.

Thanks

Upvotes: 0

Views: 644

Answers (1)

Wojciech Chmiel
Wojciech Chmiel

Reputation: 7372

You can achieve it by adding an additional opposite x-axis linked to the main one with disabled labels:

Highcharts.chart('container', {
  xAxis: [{}, {
    linkedTo: 0,
    opposite: true,
    labels: {
      enabled: false
    }
  }],
  series: [{
    data: [
      439,
      525,
      571,
      696,
      970,
      119,
      137,
      154
    ]
  }]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container"></div>

Demo:

API reference:

Upvotes: 1

Related Questions