Mikey Xuan
Mikey Xuan

Reputation: 41

Highchart clickable link in tooptip

I'm trying to create a highchart with each project has own url(clickable), for each data inside tooltip.

series: [{
  tooltip: {
    pointFormatter: function() {
      var string = '';
      Highcharts.each(toolTip[this.series.data.indexOf(this)], function(p) {
        string += '<a href="'+ urls +'">' + p + '</a><br>'
      });
      return string + "<br />";
    }
  },
  type: 'spline',
  data: data
}]

Fiddle

How can I set each project get own url from urls?

Upvotes: 0

Views: 76

Answers (1)

Deep 3015
Deep 3015

Reputation: 10075

I updated series used urls[indexs][j] instead of urls

 series: [{
  tooltip: {
    pointFormatter: function() {
      var string = '';
      var indexs = this.series.data.indexOf(this);
      Highcharts.each(toolTip[this.series.data.indexOf(this)], function(p, j) {
        string += '<a href="' + urls[indexs][j] + '">' + p + '</a><br>'
      });
      return string + "<br />";
    }
  },
  type: 'spline',
  data: data
}]

Fiddle demo

Upvotes: 2

Related Questions