javascript - Trouble getting unique tooltip based on X axis values in highcharts line graph -
i'm trying make graph in points having different x axis values have different tooltip .the 1st 2 points of series have same tooltip though x axis values different.i.e points under month of jan should have "11st comment" tooltip,points under feb should have "22nd comment" tooltip on , forth if x axis values same not y axis values..
the current computational logic tooltip depends upon y axis values.as long y axis values changing tool tip changes accordingly.this happens because of statement"this.y" in below code..
the problem logic long y axis values distinct tooltip works properly,the moment 2 consecutive points of series have same y axis values tooltip not change when x values different...
to make tooltip change acoording x axis values replacing "this.y" "this.x" desired change not happening.can please tell me how make 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> <b>' + this.y + '</b> -->' + comment;*/ return '-->'+comment; } }
the js fiddle is... http://jsfiddle.net/rbenu/25/
instead of using index datavalues
use index categories, 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; } },
Comments
Post a Comment