2013-05-08 101 views
0

使用ST2.1,我有一個散點圖,渲染器函數根據商店中的值更改所有精靈旋轉和顏色。它運作良好。 我升級到ST2.2.0,現在我無法重建相同的功能。ST2.1 vs ST2.2圖表精靈風格渲染器

代碼爲ST2.1 - 正在工作。

series: [ 
        { 
         type: 'scatter', 
         xField: 'local_date_time', 
         yField: 'wind_spd_kt', 
         marker: { ... 
          }, 
         style: { 
           renderer: function (target, sprite, index, storeItem) { 
             var sweather = Ext.getStore('Sun'); 
             if (index < sweather.getCount()){ 
              target.rotationRads = storeItem.data.sun_dir; 
              if (storeItem.data.sun_spd_kt < 10) { 
               target.fill = '#ff0000'; //red 
               //console.log (index + ' : <10 :' + storeItem.data.sun_spd_kt) 
              } 
              else { target.fill = '#00EE00'; } //green 
             } 
            } 
         }, 

代碼ST2.2.0,我試過:

style: { 
          renderer: function (sprite, config, rendererData, index) { 
             sprite.rotationRads = rendererData.store.data.all[index].raw.sun_dir 
             sprite.attr.fillStyle = '#ff0000' 
             } 
            } 

有沒有人使用 「渲染」 成功ST2.2.0?

回答

1

我制定了一個解決您的問題。你可以嘗試以下嗎?

renderer: function (sprite, config, rendererData, index) { 
    if (index % 2 == 0) { 
     return { strokeStyle: 'red' }; 
    } 
} 
+0

對不起,我錯過了通知您的答案,所以只是注意到它。我試過了,但它沒有改變任何東西。其他想法? – Fatfly 2013-07-20 13:58:30