1

I have a data set which looks something like this.

var toolTip = [ ["IN001", "IN002"], "IN003", "IN004", ["IN005", "IN006", "IN007"] ];

I have a scatter plot which uses these tooltips to show data in it.

{
      type: 'scatter',
      name: 'incidents',
      yAxis: 1,
      data: [ [0,100],[1,100],[2,100],[3,100] ],
      tooltip: {
      pointFormatter: function(){
          return "Incident " + toolTip[this.series.data.indexOf( this )] ;
        }
      }
    },

Now this shows the data in a line in tooltip. I want a next line in case there is more than one data in a tooltip. For example

IN0001
IN0002

instead of IN0001, IN0002.

How do i get the next line. I don't know how to parse this data in this case.

One more doubt i have is, Each name should be a hyperlink. How do i make every word in the toolTip array to appear as a link in the tooltip?

Any help is appreciated.

Here is a working model of the following. jsFiddle

4
  • Do you have a live example of your chart? Commented Sep 27, 2016 at 9:34
  • @GrzegorzBlachliński jsfiddle.net/o2zmLngr/3 Commented Oct 6, 2016 at 10:11
  • 1
    So you want to achieve something similar to this chart? jsfiddle.net/o2zmLngr/5 If my example will meet your requirements I will post it as ananswer Commented Oct 6, 2016 at 17:30
  • That's exactly what i wanted. Thanks a ton for the awesome answer. This definitely is the solution i was looking for. :) Commented Oct 6, 2016 at 17:46

1 Answer 1

1

You can change your pointFormatter function so you will meet your requirements. You can add breaking lines using 'br' and you can add links using 'a' like in normal HTML. You can use Highcharts.each() for iterating over your array and adding next elements to your string.

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

Here you can see an example how it can work: http://jsfiddle.net/o2zmLngr/5/

Sign up to request clarification or add additional context in comments.

2 Comments

The links don't seem to be active. I tried giving a href and clicking, but it doesn't take to the mentioned URL.
You should set pointer-events to auto in your css: jsfiddle.net/o2zmLngr/9

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.