Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Charts not updating when no data is loaded

    You found a bug! We've classified it as CHARTS-214 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #11
    Sencha User
    Join Date
    Apr 2009
    Posts
    3

    Default

    Sure, I agree. It is just a work around for anyone struggling with it at the moment.

  2. #12
    Sencha User
    Join Date
    Sep 2011
    Posts
    3

    Default

    Same problem. I did kind of UI fix that works for me:
    Code:
                'load' : function() {
                    var visiblity = 'visible';
                    if (this.getCount() == 0) {
                        visiblity = 'hidden';
                    }
                    Ext.getCmp('adtypes-pie').getEl().setStyle({visibility : visiblity});
                }

  3. #13
    Sencha User
    Join Date
    May 2009
    Posts
    158

    Default

    A side effect of keeping items in the chart visible when the store is cleared is invalid store references in records. Consider the following example:


    Code:
    Ext.onReady(function()	{
    	Ext.create("Ext.window.Window", {
    		width:500,
    		height:500,
    		layout:"fit",
    		items:[
    			{
    				xtype:"chart",
    				store:{
    					proxy:{
    						type:"memory",
    						reader:{
    							type:"json"
    						}
    					},
    					model:Ext.define("MyModel", {
    						extend:"Ext.data.Model",
    						fields:[
    							"x",
    							"y"
    						]
    					}) && "MyModel",
    					data:[
    						{
    							x:1,
    							y:2
    						},
    						{
    							x:2,
    							y:5
    						}
    					]
    				},
    				axes:[
    					{
    						type:"Numeric",
    						position:"bottom",
    						fields:["x"]
    					},
    					{
    						type:"Numeric",
    						position:"left",
    						fields:["y"]
    					}
    				],
    				series:[
    					{
    						type:"bar",
    						axis:"bottom",
    						xField:"x",
    						yField:"y",
    						tips:{
    							renderer:function(inRecord)	{
    								alert(inRecord.store.getCount());
    							}
    						}
    					}
    				],
    				listeners:{
    					afterrender:function()	{
    						var me = this;
    					
    						setTimeout(function()	{
    							me.store.removeAll();
    						}, 5000);
    					}
    				}
    			}
    		]
    	}).show();
    });
    After 5 seconds, the data in the store is removed, but the bars still show up. The series tip renderer expects the record it's passed to contain a reference to the store that contains the record, but that reference is unset when the data was removed. Now the only way to get the store from the parameter passed is to look at the item.series.chart.store

  4. #14
    Sencha User
    Join Date
    May 2012
    Posts
    1

    Default

    This seems to be fixed for bar charts in 4.1, but pie charts still intermittently remain when there's no data - the legend disappears and the pie segments no longer move on mouse-over, but the chart itself still doesn't update. Seems to happen about 1 time in 3 or 4. Any news on this?

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •