2013-07-09 21 views
0

我正在嘗試創建一個含有用圓標記的一些點的高架圖。當您將鼠標懸停在圖表上時,圖表中的所有點都有一個工具提示。禁用帶有標記的點的工具提示

但是,有標誌點的工具提示應該是來自標誌的提示。我一直在試圖看看highstock是否有API,通過它我可以判斷是否應該顯示工具提示,而不是基於該點是否有標記。然而,我堅持如何找到一個點是否有旗幟。

這裏我舉的例子的小提琴:http://jsfiddle.net/ulhas87/WSDza/

{ 
    rangeSelector: { 
     selected: 1 
    }, 
    title: { 
     text: 'USDtoEURexchangerate' 
    }, 
    yAxis: { 
     title: { 
      text: 'Exchangerate' 
     } 
    }, 
    tooltip: { 
     formatter: function(){ 
      console.log(this); 
      if(this.point){ 
       //if this point has a flag then return false 
       //else return the tooltip for this point 
       return this.y; 
      }else{ 
       //this is a flag - hence return the flag tooltip 
       return this.y; 
      } 
     }, 

    }, 
    series: [ 
     { 
      name: 'USDtoEUR', 
      data: data, 
      id: 'dataseries', 
      tooltip: { 
       valueDecimals: 4 
      }, 
      followPointer: false 
     }, 
     { 
      type: 'flags', 
      data: [ 
       { 
        x: Date.UTC(2011, 
        1, 
        14), 
        title: '', 
        text: 'Shape: "circle"' 
       }, 
       { 
        x: Date.UTC(2011, 
        3, 
        28), 
        title: '', 
        text: 'Shape: "circle"' 
       } 
      ], 
      onSeries: 'dataseries', 
      shape: 'circle', 
      width: 1, 
      height: 1, 
      y: -4, 
      states: { 
       hover: { 
        fillColor: '#395C84'//darker 
       } 
      }, 
      point: { 
       events: { 
        mouseOver: function(){ 
         console.log(this); 
        } 
       } 
      }, 
      zIndex: 10 
     }, 
     { 
      type: 'flags', 
      data: [ 
       { 
        x: Date.UTC(2011, 
        2, 
        10), 
        title: 'C', 
        text: 'Shape: "flag"' 
       }, 
       { 
        x: Date.UTC(2011, 
        3, 
        11), 
        title: 'C', 
        text: 'Shape: "flag"' 
       } 
      ], 
      color: '#5F86B3', 
      fillColor: '#5F86B3', 
      onSeries: 'dataseries', 
      width: 16, 
      style: { 
       //textstylecolor: 'white' 
      }, 
      states: { 
       hover: { 
        fillColor: '#395C84'//darker 
       } 
      }, 
      marker: { 
       fillColor: '#000000' 
      } 
     } 
    ] 
} 

得到任何幫助。謝謝

回答

0

問題是,你的櫻桃是不一樣的,你正在使用的國旗。查看更新的版本:http://jsfiddle.net/WSDza/3/

此外,我建議設置較低的hideDelay觀察員,該點沒有工具提示。