Highcharts Demo

author(s): Torstein Hønsi

by Black Label

HTML

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

<div id="container"></div>

<button onclick="clicked()"  >
Hello
</button>

CSS

body {
  width: 100%;
  height: 100%;
  margin: 0;
}

#container {
    height: 400px;
}

.excludeAction {
  color: blue;
  text-decoration: underline;
  cursor: pointer;
}

.tooltipClick {
  cursor: pointer
}

JavaScript

clicked = function() {
  alert('Hello')
}

Highcharts.AST.allowedAttributes.push('onclick');

Highcharts.chart('container', {
  chart: {
    type: 'scatter'
  },
  xAxis: {
    categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
  },
  tooltip: {
    useHTML: true,
    style: {
      pointerEvents: 'auto'
    },
    formatter: function(e) {
      return '<div>' + this.x + ': ' + this.y + '<br><a href="www.google.com">Click Me</a><br><button onclick="clicked()" >Hello</button></div>'
    }
  },
  plotOptions: {
    series: {
      cursor: 'pointer',
      point: {
        events: {
          click: function() {
            alert('Category: ' + this.category + ', value: ' + this.y);
          }
        }
      }
    }
  },

  series: [{
    data: [
      [1, 1],
      [2, 3],
      [3, 6],
      [4, 1],
      [5, 5]
    ]
  }]
});