Highcharts Stock Demo

author(s): Torstein Hønsi

by Black Label

HTML

<div id="container" style="height: 400px; min-width: 600px"></div>

<script src="https://code.highcharts.com/stock/highstock.js"></script>

JavaScript

Highcharts.stockChart('container', {
  xAxis: {
    title: {
      text: 'Price'
    },
    ordinal: false,
    labels: {
      formatter: function() {
        return this.value;
      }
    },
    crosshair: {
      width: 0.5,
      color: 'black',
      label: {
        backgroundColor: 'rgb(255,0,0)',
        formatter: function(value) {
          return 'this is a long label: ' + value;
        },
        enabled: true,
        padding: 8
      }
    }
  },

  tooltip: {
    headerFormat: ''
  },

  yAxis: {
    labels: {
      formatter: function() {
        return this.value + ' units';
      }
    }
  },

  rangeSelector: {
    enabled: false
  },
  navigator: {
    enabled: false
  },

  series: [{
    type: 'areaspline',
    data: [
      ['1', 1],
      ['2', 3],
      ['3', 1],
      ['4', 4]
    ]
  }]

});