2013-08-20 33 views
2

我使用highchart.js显示一个月内员工的签到时间和签出时间图。工具提示不显示在高图上

  • X轴将是月中的某一天。
  • Y轴是一天中的小时。

我想自定义工具提示要像

Check In 
5 Aug: 09:40 am 

Check Out 
5 Aug: 09:40 am 

出于某种奇怪的原因,它只能显示默认格式x和y。 代码在这里: http://jsfiddle.net/BFnL9/1/

这里有什么bug。

回答

2

你的工具提示定义是好的,但它是在错误的地方。尝试把它放在与plotOptions相同的级别而不是里面。

 tooltip: { 
     crosshairs: true, 
     formatter: function(){ 
      // THIS FUNCTION DOESNT RUN ?????????? 
      return '<b>'+ this.series.name +'</b><br/>'+ 
      Highcharts.dateFormat('%e %b', this.x) +': '+ Highcharts.dateFormat('%H %M', this.y) ; 
     } 

     // headerFormat: '<b>{series.name}</b><br>', 
     // pointFormat: 'Day {point.x}, Time: {point.y}' 
     }, 

http://jsfiddle.net/JpMnF/

+0

事实上,格式化仅在提示的水平,不支持的系列。 '这些选项](http://api.highcharts.com/highcharts#plotOptions.series.tooltip)由'plotOptions.series.tooltip'支持。 –

+0

感谢您的快速回复:) – aladine