Trouble getting unique tooltip based on X axis values in highcharts line graph

I'm trying to make a graph in which points having different x axis values have different tooltip .The 1st two points of a series have the same tooltip even though their x axis values are different.i.e points under the month of jan should have "11st comment" tooltip,points under Feb should have "22nd comment" tooltip so on and so forth even if their x axis values are same but not y axis values..

The current computational logic is that the tooltip depends upon the y axis values.As long as y axis values are changing the tool tip changes accordingly.This happens because of the statement"this.y" in the below code..

The problem with this logic is that as long as y axis values are distinct the tooltip works properly,the moment 2 consecutive points of a series have same y axis values the tooltip does not change when their x values are different...

To make the tooltip change acoording to x axis values I am replacing "this.y" with "this.x" but the desired change is not happening.Can you please tell me how to make that change?

The tool tip code..

       tooltip: {
       formatter: function () {
        var serieI = this.series.index;
      var index = dataValues.indexOf(this.y);
     var index1= dataValues2.indexOf(this.y);
      debugger;
        var comment = "";
        if (serieI == 0) {
            comment = $("#ppForm.textarea:eq(" + (index) + ")").val();
        } else {
           //comment = "second serie matched!";
            comment = $("#ppForm.textarea:eq(" + (index1) + ")").val();
        }
        /*return ''+ this.x +
            '</b> is <b>' + this.y + '</b> -->' + comment;*/
        return '-->'+comment;
    }
}

The js fiddle is... http://jsfiddle.net/RbenU/25/

Answers


Instead of using index for dataValues use index for categories, this way: http://jsfiddle.net/RbenU/39/

tooltip: {
        formatter: function () {
            var serieI = this.series.index;
            var index = categories.indexOf(this.x);
            var comment = $("input:eq(" + (index) + ")").val();
            return '-->'+comment;
        }
    },

Need Your Help

Do I put constants in database or use file to save it

php mysql constants codeigniter-2

Is that better to use database or file to save constants in my project?

How can I list all sequences created by hibernate in mysql database?

java mysql hibernate

I have troubles with creating id field in hibernate. I want to list all sequences from mysql console. How?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.