1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    9
    Vote Rating
    0
    kalya is on a distinguished road

      0  

    Default Unanswered: Bar chart problem with external store

    Unanswered: Bar chart problem with external store


    Hi guys! I have the problem: when i use fixed data for the store everything works fine, but when i am trying to get data via proxy - does nothing. Here is my code for the store and cahrt

    PHP Code:
    var store = new Ext.data.Store( {     
               
    fields: ['name','data1'],                
               
    proxy: { 
                          
    type'ajax'
                          
    urldata_url,           
                          
    reader'json'        },
               
    autoLoad:true           }); 


     var 
    chart = {
                  
    xtype"chart"theme"Stats"storestorewidth300height500animatetrue,   
                  
    axes: [  
                            { 
    type"Category"position'left'title"Places"fields: [ "name" ] },   
                            { 
    type"Numeric",  position'bottom'title"CTR"fields: [ "data1" ], gridtrueminimum}        ],       
                   
    series: [ 
                         {
    type"bar"axis"bottom"xField"name"yField: ["data1"],           
                                       
    tips: {                trackMousetruewidth140height28,                
                            
    renderer: function(storeItem) { this.setTitle(storeItem.get('data1') + ' data1') }            }        } ]    };

        return 
    chart
    json return
    PHP Code:
    [                {"name":"banner_1","data1":0.15},                {"name":"banner_2","data1":0.12}] 
    Please guys help me! I've been stucked with this for 3 days

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,408
    Answers
    3549
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Have you checked out the examples? I made the custom bar chart to work with your data.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    9
    Vote Rating
    0
    kalya is on a distinguished road

      0  

    Default


    Sure I read it. But in the example is used fixed json data. In such case my charts are working, but when i change it to proxy, it stop working! this is the point

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,408
    Answers
    3549
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Quote Originally Posted by kalya View Post
    Sure I read it. But in the example is used fixed json data. In such case my charts are working, but when i change it to proxy, it stop working! this is the point
    I changed the store to run off a php script and it worked for me.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Nov 2011
    Posts
    9
    Vote Rating
    0
    kalya is on a distinguished road

      0  

    Default


    could you give a me a link please??

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,408
    Answers
    3549
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Quote Originally Posted by kalya View Post
    could you give a me a link please??
    Code:
    var store = Ext.create('Ext.data.Store', {
        autoLoad : true,
        fields : ['name', 'data1'],
    
        proxy : {
            type : 'ajax',
            url  : 'data.php',
            reader : {
                type : 'json
            }
        }
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  7. #7
    Sencha User
    Join Date
    Nov 2011
    Posts
    9
    Vote Rating
    0
    kalya is on a distinguished road

      0  

    Default


    my code above is the same, and my charts are not working. php script return valid json string. What's wrong? i dont know how to make it work. I tried everthing i found but nothing is working

  8. #8
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,408
    Answers
    3549
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Are you getting an error? Maybe that renderer is not defined on your category axis?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  9. #9
    Sencha User
    Join Date
    Nov 2011
    Posts
    9
    Vote Rating
    0
    kalya is on a distinguished road

      0  

    Default


    no error. i defined series with renderer
    Code:
    series: [{            type: 'bar',
                axis: 'bottom',
                highlight: true,
                tips: {
                    trackMouse: true,
                    width: 140,
                    height: 28,
                    renderer: function(storeItem, item) {
                        this.setTitle(storeItem.get('data1') + ': ' + storeItem.get('data2') + ' views');
                    }
                }, 
                xField: 'data1',
                yField: ['data2']
            }]

  10. #10
    Ext JS Premium Member
    Join Date
    Jan 2008
    Location
    Germany, Berlin
    Posts
    135
    Answers
    21
    Vote Rating
    11
    fschaeffer will become famous soon enough

      0  

    Default


    Please compare both JSON returns if they are exactly the same. I once had a similar issue where the proxy returned my numeric values encoded as string. This yielded to a not shown bar chart. When I changed the field definition to int in the model everything was working again.