1. #1
    Ext User
    Join Date
    Dec 2008
    Posts
    88
    Vote Rating
    -1
    ektanit is an unknown quantity at this point

      0  

    Default What is the best way to relaod store of the pie chart

    What is the best way to relaod store of the pie chart


    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 -

    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'));
       }

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,445
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    There are a number of fixes related to Charts in SVN. These will be released with Ext 3.0 RC2.1.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Ext User
    Join Date
    Dec 2008
    Posts
    88
    Vote Rating
    -1
    ektanit is an unknown quantity at this point

      0  

    Default


    Thanks aconran,
    When is the expected release date ?

Thread Participants: 1