PDA

View Full Version : Any Issues with Pie Chart, Please help.



ektanit
10 Jun 2009, 7:56 AM
Hi, I am not sure if this is reported as a bug but I am looking for some help to display the pie chart. The pie chart creation , its data store and the JSON response is shown below.



var piecht = new Ext.Panel({
iconCls:'chart',
title: 'ExtJS.com',
frame:true,
width:600,
height:300,
layout:'fit',
items: {
xtype: 'piechart',
store: firstchartstore,
dataField: 'value'
},
url:'/ext-3.0-rc1/resources/charts.swf'
});

var firstchartstore = new Ext.data.JsonStore(
{
fields: [
,{name: 'key', type: 'string'}
,{name: 'value', type: 'int'}
],
root: 'firstchart.chartData'

});

function LoadAndShow(combovalue,clientcombo){
firstchartstore.on('load', loadSuccessfulChart);
piecht.render(document.getElementById('pchart'));
-- prepare the URL String
Ext.Ajax.request({
url: urlStr,
success: function(response) {
var data = Ext.decode(response.responseText);
firstchartstore.loadData(data);

}
});
}

function loadSuccessfulChart(store, recordArray, options) {
alert("chart store loaded");
}

JSON RESPONSE -
{"firstchart":{"chartData":[{"key":"BLACKRCK","value":2983},{"key":"GSAM2","value":542}],"message":"Successfully
retrieved chart data","success":true}}

hendricd
10 Jun 2009, 8:07 AM
Perhaps an explanation of the problem ?

ektanit
10 Jun 2009, 8:09 AM
Oops, I missed. The pie chart does not display at all.

hendricd
10 Jun 2009, 8:15 AM
Try RC2 and/or defeat SWF caching by making the url unique:

url:'/ext-3.0-rc1/resources/charts.swf?_dc='+new Date().getTime()

ektanit
10 Jun 2009, 10:10 AM
I made changes to the URL but no use. I am sorry but I did not get you when you wrote to try RC2 . What does this mean ?

hendricd
10 Jun 2009, 10:50 AM
I made changes to the URL but no use. I am sorry but I did not get you when you wrote to try RC2 . What does this mean ?

Are you using Ext 3. RC2?

ektanit
10 Jun 2009, 1:31 PM
I tried even with RC2.
The column chart comes up so nice but the pie chart never shows up.
I really need this to work as I love the Ext js framework and would want my application to port on extjs.

ektanit
12 Jun 2009, 1:06 PM
see here- I had put the same data as what seen in JSON response and the pie chart comes up but when the store is configured to understand the JSON response, it does not show the pie chart. What is the problem here ?



// This comes up
var firstchartstore = new Ext.data.JsonStore({
fields:['key', 'value'],
data:[{"key":"BLACKRCK","value":2983},{"key":"GSAM2","value":542}] });

// This does not
/*var firstchartstore = new Ext.data.JsonStore(
{
fields:['key', 'value'],
root: 'firstchart.chartData'

});
*/

This is how I load the store.

function LoadAndShow(){
firstchartstore.on('load', loadSuccessfulChart);
-- prepare the URL String urlStr
Ext.Ajax.request({
url: urlStr,
success: function(response) {
var data = Ext.decode(response.responseText);
firstchartstore.loadData(data);
}
});
}

function loadSuccessfulChart(store, recordArray, options) {
alert("chart store loaded");

}


My JSON response as seen in firebug is

{"firstchart":{"chartData":[{"key":"BLACKRCK","value":2983},{"key":"GSAM2","value":542}],"message":"Successfully
retrieved chart data","success":true}}

ektanit
15 Jun 2009, 11:50 AM
Hi, Can I get a reply on this..gurus please help. I read from an earlier post today that you are doing another release this week for EXTJS3.0 bug fixes. I am not sure if this is my problem because of some silly mistake .