C# 从.NETWeb服务将最大值设置为extjs语言图表

C# 从.NETWeb服务将最大值设置为extjs语言图表,c#,extjs,charts,C#,Extjs,Charts,我在extjs中使用MVC方法得到了一个语言图表,在C#中得到了一个web方法,我用它来获取图表的数据。我从C#web方法得到的代码是 <root> <record> <count>10</count> <total>20</total> </record> </root> 还有一个观点 Ext.define('myview' ,{ extend: 'Ext.pane

我在extjs中使用MVC方法得到了一个语言图表,在C#中得到了一个web方法,我用它来获取图表的数据。我从C#web方法得到的代码是

<root>
  <record>
    <count>10</count>
    <total>20</total>
  </record>
</root>
还有一个观点

Ext.define('myview' ,{
    extend: 'Ext.panel.Panel',
    alias: 'myview',
    initComponent: function()
var store1 = Ext.create('mystore');
Ext.apply(this, {
            layout: 'vbox',
            height:300,           

            items: [{...
},{                    
                    width:'50%',
                    height:200,
                    xtype: 'chart',

                    style: 'background:#FFFFFF',
                    animate: {
                        easing: 'bounceOut',
                        duration: 500
                    },

                    store: store1,
                    insetPadding: 25,
                    flex: 1,
                    axes: [{
                        type: 'gauge',
                        position: 'gauge',
                        minimum: 0,
                        maximum: 100, //here instead of 100 I need to get a value from //xml from web method. So here I need to get total
                        steps: 10,
                        margin: 7
                    }],
                    series: [{
                        type: 'gauge',
                        field: 'count',
                        donut: 60,
                        colorSet: ['#3AA8CB', '#DDDDDD']
                    }]
                }]

我通过创建存储的对象来动态设置最大值:

var store1 = Ext.create('app.store.MyStore');
然后使用存储加载:

store1.load({
        callback: function(records, operation, success) {            
            var g = Ext.getCmp('my gauge id');
            g.axes.getAt(0).maximum = records[0].data.a field from C# query put into xml;
        }
    });

感谢Alexander的回答和评论。

能否请您详细说明如何将数据从xml获取到图表中?我使用MVC模型,并通过store.Ext.define('myStore',{extend:'Ext.data.store',proxy:{type:'ajax',url:'url to asmx/web_method',extraParams:{type:'p_ready'},reader:{type:'xml',root:'root',record:'record'}}什么是
store.getProxy().getReader().rawData
包含?10 20,所以现在您有了数据(
store.getProxy().getReader().rawData
),并且您知道将它放在哪里(
gauge.axes[0]。最大值
),对吗?
store1.load({
        callback: function(records, operation, success) {            
            var g = Ext.getCmp('my gauge id');
            g.axes.getAt(0).maximum = records[0].data.a field from C# query put into xml;
        }
    });