将数组值显示为高图中的唯一工具提示 [英] Display array values as unique tooltip in highcharts

查看:134
本文介绍了将数组值显示为高图中的唯一工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在highcharts线图中显示数组的值作为工具提示。我目前使用从文本框输入的值作为工具提示,但试图显示数组值作为工具提示。js小提琴在这里给出 http://jsfiddle.net/RbenU/75/



我使用的tooltip代码是..

 工具提示:{
formatter:function(){
var serieI = this.series.index;
var index = categories.indexOf(this.x);
var comment = $(input:eq(+(index)+))。val();
return' - >'+ comment;




$ b我希望显示数组n的值作为工具-tip即JAN的n [0]元素,2月的n [1]元素等等等等。属于同一月份的点将具有相同的工具提示。

解决方案

只需使用您从categories数组获得的索引即可从n获得该值:

  tooltip:{
formatter:function(){
var index = categories.indexOf(this.x);
return n [index];
}
},


I am trying to display values of an array as tooltip in highcharts line graph.I am currently using values entered from a textbox as tooltip but trying to display array values as tooltip..the js fiddle is given here http://jsfiddle.net/RbenU/75/

the tooltip code i am using is..

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

I want to display values of array n as tool-tip i.e. n[0] element for JAN, n[1] element for Feb so on and so forth..Points falling under the same month will have same tooltip..

解决方案

Just use the index you are getting from the categories array to get that value from n:

tooltip: {
    formatter: function () {
        var index = categories.indexOf(this.x);
        return n[index];
    }
},

这篇关于将数组值显示为高图中的唯一工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆