soubhagya ranjan
11 Nov 2011, 2:34 AM
I m new to the sencha touch. I am trying to parse the xml file from from a cross domain server, i. e. my application is running on my localhost with this url(http://172.19.72.11:8050/SenchaTouchTest/MyGraph.html)
i am trying to parse a xml file from the server of different ip(http://172.19.72.30:8080/cip-cits/services/CitsService/getOutageMetrics) but i m getting the following error in the chrome console.
XMLHttpRequest cannot load http://172.19.72.30:8080/cip-cits/services/CitsService/getOutageMetrics?_dc=1321004361361&limit=25. Origin http://172.19.72.11:8050 (http://172.19.72.11/) is not allowed by Access-Control-Allow-Origin.
sencha-touch.js:6 (http://172.19.72.11:8050/SenchaTouchTest/resources/js/sencha-touch.js)Uncaught TypeError: Cannot read property 'length' of undefined
[COLOR=red !important]
Ext.setup({
onReady: function() {
var drawComponent = new Ext.draw.Component();
var store = new Ext.data.JsonStore({
fields: ['label','value1','value1name','value2','value2name' ],
method:'get',
proxy: {
type: 'ajax',
url:'http://172.19.72.30:8080/cipcits/services/CitsService/getOutageMetrics',
reader: {
type: 'xml',
root : 'barChartPlotsList',
record: 'barChartPlots'
}
}
});
store.load();
var colors = ['url(#v-1)', 'url(#v-2)'];
new Ext.chart.Panel({
renderTo: Ext.getBody(),
items: drawComponent,
width: 400,
height: 300,
title: 'Root Cause Analysis',
items: {
animate: {
easing: 'bounceOut',
duration: 250
},
store: store,
shadow: false,
gradients: [{
'id': 'v-1',
'angle': 165,
stops: {
80: {
color: '#488AC7'
},
100: {
color: '#2B3856'
}
}
},
{
'id': 'v-2',
'angle': 30,
stops: {
0: {
color: '#C11B17'
},
100: {
color: '#595454'
}
}
} ],
axes: [{
type: 'Numeric',
position: 'left',
fields: ['value1', 'value2'],
minimum: 0,
maximum: 10,
decimal:2,
label: {
renderer: function(v) {
return v.toFixed(0);
}
}
},
{
type: 'Category',
position: 'bottom',
fields: ['label'],
label: {
rotate: {
degrees: 340
}
}
}],
series: [{
type: 'column',
axis: 'left',
highlight: true,
renderer: function(sprite, storeItem, barAttr, i, store) {
barAttr.fill = colors[i % colors.length];
return barAttr;
},
label: {
display: 'outside',
'text-anchor': 'middle',
field: ['value1', 'value2'],
orientation: 'horizontal',
font:'20px Helvetica, sans-serif'
},
xField: 'label',
yField:['value1', 'value2']
}]
}
});
}});
the xml file is follows
<barChartPlotsList>
<barChartPlots>
<label>FY11Q2</label>
<value1>1</value1>
<value1name>KNOWN</value1name>
<value2>5.4</value2>
<value2name>UNKNOWN</value2name>
</barChartPlots>
<barChartPlots>
<label>FY11Q2</label>
<value1>2</value1>
<value1name>KNOWN</value1name>
<value2>5.8</value2>
<value2name>UNKNOWN</value2name>
</barChartPlots>
<barChartPlots>
<label>FY11Q2</label>
<value1>3</value1>
<value1name>KNOWN</value1name>
<value2>5.1</value2>
<value2name>UNKNOWN</value2name>
</barChartPlots>
<barChartPlots>
<label>FY11Q2</label>
<value1>1</value1>
<value1name>KNOWN</value1name>
<value2>5.7</value2>
<value2name>UNKNOWN</value2name>
</barChartPlots>
</barChartPlotsList>
can anyone please help me thanks in advance
i am trying to parse a xml file from the server of different ip(http://172.19.72.30:8080/cip-cits/services/CitsService/getOutageMetrics) but i m getting the following error in the chrome console.
XMLHttpRequest cannot load http://172.19.72.30:8080/cip-cits/services/CitsService/getOutageMetrics?_dc=1321004361361&limit=25. Origin http://172.19.72.11:8050 (http://172.19.72.11/) is not allowed by Access-Control-Allow-Origin.
sencha-touch.js:6 (http://172.19.72.11:8050/SenchaTouchTest/resources/js/sencha-touch.js)Uncaught TypeError: Cannot read property 'length' of undefined
[COLOR=red !important]
Ext.setup({
onReady: function() {
var drawComponent = new Ext.draw.Component();
var store = new Ext.data.JsonStore({
fields: ['label','value1','value1name','value2','value2name' ],
method:'get',
proxy: {
type: 'ajax',
url:'http://172.19.72.30:8080/cipcits/services/CitsService/getOutageMetrics',
reader: {
type: 'xml',
root : 'barChartPlotsList',
record: 'barChartPlots'
}
}
});
store.load();
var colors = ['url(#v-1)', 'url(#v-2)'];
new Ext.chart.Panel({
renderTo: Ext.getBody(),
items: drawComponent,
width: 400,
height: 300,
title: 'Root Cause Analysis',
items: {
animate: {
easing: 'bounceOut',
duration: 250
},
store: store,
shadow: false,
gradients: [{
'id': 'v-1',
'angle': 165,
stops: {
80: {
color: '#488AC7'
},
100: {
color: '#2B3856'
}
}
},
{
'id': 'v-2',
'angle': 30,
stops: {
0: {
color: '#C11B17'
},
100: {
color: '#595454'
}
}
} ],
axes: [{
type: 'Numeric',
position: 'left',
fields: ['value1', 'value2'],
minimum: 0,
maximum: 10,
decimal:2,
label: {
renderer: function(v) {
return v.toFixed(0);
}
}
},
{
type: 'Category',
position: 'bottom',
fields: ['label'],
label: {
rotate: {
degrees: 340
}
}
}],
series: [{
type: 'column',
axis: 'left',
highlight: true,
renderer: function(sprite, storeItem, barAttr, i, store) {
barAttr.fill = colors[i % colors.length];
return barAttr;
},
label: {
display: 'outside',
'text-anchor': 'middle',
field: ['value1', 'value2'],
orientation: 'horizontal',
font:'20px Helvetica, sans-serif'
},
xField: 'label',
yField:['value1', 'value2']
}]
}
});
}});
the xml file is follows
<barChartPlotsList>
<barChartPlots>
<label>FY11Q2</label>
<value1>1</value1>
<value1name>KNOWN</value1name>
<value2>5.4</value2>
<value2name>UNKNOWN</value2name>
</barChartPlots>
<barChartPlots>
<label>FY11Q2</label>
<value1>2</value1>
<value1name>KNOWN</value1name>
<value2>5.8</value2>
<value2name>UNKNOWN</value2name>
</barChartPlots>
<barChartPlots>
<label>FY11Q2</label>
<value1>3</value1>
<value1name>KNOWN</value1name>
<value2>5.1</value2>
<value2name>UNKNOWN</value2name>
</barChartPlots>
<barChartPlots>
<label>FY11Q2</label>
<value1>1</value1>
<value1name>KNOWN</value1name>
<value2>5.7</value2>
<value2name>UNKNOWN</value2name>
</barChartPlots>
</barChartPlotsList>
can anyone please help me thanks in advance