2015-10-28 58 views
0

我需要將某些像素的標記符號翻譯爲不與系列線重疊。但似乎沒有任何工作。任何建議?標記變換(平移)不起作用

代碼:

$(function() { 
    $('#container').highcharts({ 
    title: { 
     text: 'Monthly Average Temperature', 
     x: -20 //center 
    }, 
    series: [{ 
     marker: { 
      symbol: 'url(http://www.highcharts.com/demo/gfx/snow.png)', 

     }, 
     data: [{ 
      y: 10, 
     }, { 
      y: 25, 
     }, { 
      y: 12, 
     }, { 
      y: 31 
     }] 
    }] 
},function(chart){ 

    $.each(chart.series[0].data,function(i,point){ 


     this.graphic.attr({ 
      transform: "translate(-13,0)" 
     }); 

    }); 

    }); 
}); 

的jsfiddle鏈接:http://jsfiddle.net/yd8hV/13/

回答

3

你應該換你。每個$()函數成的setTimeout()函數。

setTimeout(function() { 
      $.each(chart.series[0].data, function (i, point) { 
       this.graphic.attr({ 
        transform: "translate(-15,-35)" 
       }); 
      }); 
     }, 50); 

您需要這樣做,因爲轉換選項比您的回調函數晚修改。

示例: http://jsfiddle.net/izothep/yd8hV/20/