2015-02-05 57 views
0

我使用plotbands来标记图上的区域,但是因为我不希望它们被着色,所以我将它们设置为0的透明度。但是, ,我似乎陷入了两个选择:将它们放在所有内容的前面,在这种情况下,我无法将鼠标悬停在点上以显示工具提示,或者在所有情况下都背后,文本会变得淡红色面积图。我设置我的工具提示zIndex非常高,没有结果。将我的标签放在图的前面,不遮挡点

enter image description here

xAxis: { 
      type: 'datetime', 
      plotBands: [{ 
      { 
       color: 'rgba(255, 255, 255, 0)', 
       from: new Date(2001, 1, 3).getTime(), 
       to: new Date(2009, 1, 21).getTime(), 
       zIndex: 2, 
       label: { 
        text: "Low zIndex, label is reddish", 
        verticalAlign: 'bottom', 
        y: bandLabelVertOffset, 
        style: { 
         fontSize: bandLabelFontSize, 
         lineHeight: bandLabelLineSpacing, 
         color: 'black', 
         fontWeight: 'bold', 
        } 
       } 
      }, 
      { 
       color: 'rgba(255, 255, 255, 0)', 
       from: new Date(2009, 1, 21).getTime(), 
       to: new Date(2013, 0, 0).getTime(), 
       zIndex: 20, 
       label: { 
        text: "High zIndex, can't click points", 
        verticalAlign: 'bottom', 
        y: bandLabelVertOffset, 
        style: { 
         fontSize: bandLabelFontSize, 
         lineHeight: bandLabelLineSpacing, 
         color: 'black', 
         fontWeight: 'bold', 
        } 
       } 
      }], 

    tooltip: { 
     enabled: true, 
     useHTML: true, 
     zIndex: 4000, 
    }, 
+0

添加文本如果有更好的方法来添加标签比使用plotBands,我接受这一点。 – thumbtackthief 2015-02-05 19:01:34

+0

或者有没有办法直接设置点的zIndex? – thumbtackthief 2015-02-05 19:16:46

+1

您可以通过[Renderer](http://api.highcharts.com/highcharts#Renderer.text)和[labels](http://api.highcharts.com/highcharts#labels)添加 – 2015-02-06 10:53:29

回答