PDA

View Full Version : What is the best way to relaod store of the pie chart



ektanit
22 Jun 2009, 5:20 AM
Hi, I was having some issues with pie chart rendering with store configured to read data given as a JSON response from the server. The issue is resolved by having the pie chart rendered only after the load() call completes. Now IF i have new records in the store, the pie chart is again not coming up. What is the best way to render the chart with the new records in the store. FYI- I checked the store contents and it does have newer data. Here is my code -


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

});

var piecht = new Ext.Panel({
title: 'Client Vs Lots for trade data',
autoWidth: true,
height: 300,
layout: 'fit',
items: {
xtype: 'piechart',
store: firstchartstore,
categoryField: 'key',
dataField: 'value',
chartStyle: {
legend: {
display: 'right'
}
}
}
});

firstchartstore.on('load', loadSuccessfulChart);

/* The below method works good when it is called on a button click event for the first but does not when rendering the pie chart subsequently */
function LoadAndShow(combovalue,clientcombo){
var urlStr = '/ext/testServlet?action=listTrade'
Ext.Ajax.request({
url: urlStr,
success: function(response) {
var data = Ext.decode(response.responseText); firstchartstore.loadData(data);
}
});
}

function loadSuccessfulChart(store, recordArray, options) {
alert(store.getAt(0).data.key + " " + store.getAt(0).data.value );
piecht.render(document.getElementById('pchart'));
}

aconran
23 Jun 2009, 9:20 AM
There are a number of fixes related to Charts in SVN. These will be released with Ext 3.0 RC2.1.

ektanit
23 Jun 2009, 9:40 AM
Thanks aconran,
When is the expected release date ?