码迷,mamicode.com
首页 > 其他好文 > 详细

自定义highchart tooltip

时间:2015-03-04 14:39:46      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:highcharts   tooltip   

贴一段自定义highchart tooltip的代码

实线了垮series的计算和顺序切换

 formatter: function () {
          // var str = getTooltip(this);
          var str = ‘<b>‘ + Highcharts.dateFormat(config_timelabelformats.day, this.x) + ‘</b>‘;
          var ele = null;

          $.each(this.points, function () {
            if(this.series.name == highstock_local()[‘electricity‘]){
              ele = this;
            }else if(this.series.name == highstock_local()[‘net_income‘]){
              if(ele == null){
                str += ‘<br/>‘ + this.series.name + ":" + this.y;
              }else{
                if(ele.series.visible == true && this.series.visible == true){
                  str += ‘<br/>‘ + highstock_local()[‘payout‘] + ":" + (this.y + ele.y);
                  str += ‘<br/>‘ + highstock_local()[‘electricity‘] + ":" + (ele.y);
                }else{
                  str += ‘<br/>‘ + highstock_local()[‘electricity‘] + ":" + (ele.y);
                }
              }

            }else{
              str += ‘<br/>‘ + this.series.name + ‘: ‘ +
                  this.y;
            }
          });
          return str;
      }

自定义highchart tooltip

标签:highcharts   tooltip   

原文地址:http://blog.csdn.net/tuoxz/article/details/44059733

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!