2012-08-15 78 views
1

當我嘗試創建分散extjs圖表時,我遇到過這樣的問題: 分類軸名稱未分組(具有標識名的數組元素不被視爲相同)。看起來圖表試圖將其作爲一種數學函數(每個x只有y的一個元素),但我故意選擇散點圖來避免它。Extjs 4分類軸分組

試圖找到在谷歌的大雁,但我發現唯一的結果就是接受...

這是代碼:

window.store_direct = Ext.create('Ext.data.JsonStore', { 
fields: ['id','line','bidder','data0','data1','data2','data3'], 
data: [ 
{'line':1000.00,'id':0,'bidder':'Пок','data0':1000.00}, 

{'line':800.00,'id':1,'bidder':'Пок','data0':800.00}, 

{'line':950.00,'id':0,'bidder':'Брг','data1':950.00}, 

{'line':599.00,'id':1,'bidder':'Брг','data1':599.00}, 

{'line':1.00,'id':2,'bidder':'Брг','data1':1.00}, 

{'line':500.00,'id':0,'bidder':'КВВ','data2':500.00}, 

{'line':900.00,'id':0,'bidder':'Buy4','data3':900.00}, 

{'line':600.00,'id':1,'bidder':'Buy4','data3':600.00} 
], 

});

var chart = function() { 
var win = Ext.create('Ext.Window', { 
    renderTo: Ext.getBody(), 
    width: 500, 
    height: 300, 
    animate: true, 
    hidden: false, 
    maximizable: true, 
    title: 'Процесс торгов', 
    layout: 'fit', 
    items:{xtype: 'chart',style: 'background:#fff;',animate: true,store: store_direct,shadow: true,legend: {position: 'right'}, 
    axes: [{ 
     type: 'Numeric', 
     position: 'left', 
     fields: ['data0','data1','data2','data3'], 
     label: { 
      renderer: Ext.util.Format.numberRenderer('0,0') 
     }, 
     title: 'Sample Values', 
     grid: true, 
     minimum: 0 
    }, { 
     type: 'Category', 
     position: 'bottom', 
     fields: ['bidder'], 
     title: 'Sample Metrics' 
    }], 
    series: [ 
    { 
     type: 'Scatter', 
     highlight: {size: 7,radius: 7}, 
     axis: 'left', 
     xField: 'bidder', 
     yField: 'data0', 
     markerConfig: {type: 'cross',size: 4,radius: 4,'stroke-width': 0} 
    } 
    , { 
     type: 'Scatter', 
     highlight: {size: 7,radius: 7}, 
     axis: 'left', 
     xField: 'bidder', 
     yField: 'data1', 
     markerConfig: {type: 'cross',size: 4,radius: 4,'stroke-width': 0} 
    } 
    , { 
     type: 'Scatter', 
     highlight: {size: 7,radius: 7}, 
     axis: 'left', 
     xField: 'bidder', 
     yField: 'data2', 
     markerConfig: {type: 'cross',size: 4,radius: 4,'stroke-width': 0} 
    } 
    , { 
     type: 'Scatter', 
     highlight: {size: 7,radius: 7}, 
     axis: 'left', 
     xField: 'bidder', 
     yField: 'data3', 
     markerConfig: {type: 'cross',size: 4,radius: 4,'stroke-width': 0} 
    } 
      ] 
    } 
}); 

}

回答

0

Ext JS的圖表術語是有點特定;在這種情況下,您需要配置您的系列。有一些好的圖表示例,看看:http://docs.sencha.com/ext-js/4-1/#!/example

+0

嗯,我試圖配置他們,但未能實現所需的。並看到我的系列描述和描述在這裏沒有區別:http://docs.sencha.com/ext-js/4-1/#!/example/charts/Scatter - Renderer.html – 2012-08-16 06:10:55

+0

忘記告訴我也是試圖在「系列」或「軸」中使用這樣的字符串「categoryNames:'Buy4,КВВ,Пок,Брг'」。但是兩個變種都失敗了 – 2012-08-16 13:25:09