2011-06-14 27 views

回答

1

這是目前在ExtJS的4.0.6及更早的一個報告的問題。 See here for details on the sencha forums

問題似乎是因爲量表不會實現isItemInPoint,它絕不會支持突出顯示或提示 - 圖表系列的getItemForPoint函數使用isItemInPoint來確定系列中的哪個項目位於x/y座標。

同煎茶論壇發佈用戶「minneyar」提出了一個變通現在通過實現對量具系列原型isItemInPoint方法,下面是該代碼:

Ext.chart.series.Gauge.override({ 
    isItemInPoint: function(x, y, item, i) { 
     var chartBBox = this.chart.chartBBox; 
     var centerX = this.centerX = chartBBox.x + (chartBBox.width/2); 
     var centerY = this.centerY = chartBBox.y + chartBBox.height; 
     var outerRadius = Math.min(centerX - chartBBox.x, centerY - chartBBox.y); 
     var innerRadius = outerRadius * +this.donut/100; 

     var r = Math.sqrt(Math.pow(centerX-x, 2) + Math.pow(centerY-y,2)); 

     return r > innerRadius && r < outerRadius; 
    } 
});