PDA

View Full Version : [FIXED]Charts hang FireFox



margozzi
16 Feb 2011, 3:09 PM
I tried to modify one of the working Chart examples to get live data from my back end.
When I run the page, Firefox 3.6.13 hangs and is unusable, I have to kill it with the task manager.
Firebug doesn't show any errors or any network traffic to actually retrieve the data. It is hard to
know if it would have since the entire browser is hung. I Can't even switch tabs. Looking with the Task Manager I can see the CPU utilization is about 50% on Firefox. The memory usage is bouncing between roughly 150M and 200M quickly.

Here is my code:

Ext.require('Ext.chart.*');
Ext.require('Ext.layout.container.Fit');

Ext.onReady(function() {

Ext.regModel('TimedLong', {
fields: ['Time', 'Value'
],
idProperty: 'Time'
});

var store = new Ext.data.Store({
pageSize: 50,
model: 'TimedLong',
autoload: true,
proxy: {
type: 'ajax',
url : '/dxi/rest/CpuStats/CPU1?filter=Time(GT)0',
reader: {
type: 'xml',
record : 'TimedLong',
idProperty : 'Time',
totalProperty : 'TotalCount'
}
}
});

var panel = Ext.create('widget.panel', {
width: 600,
height: 300,
title: 'CPU utilization',
renderTo: Ext.getBody(),
layout: 'fit',
items: {
xtype: 'chart',
animate: false,
store: store,
insetPadding: 30,
axes: [{
type: 'Numeric',
minimum: 0,
position: 'left',
fields: ['Value'],
title: false,
grid: true,
label: {
renderer: Ext.util.Format.numberRenderer('0,0'),
font: '10px Arial'
}
}, {
type: 'Time',
position: 'bottom',
fields: ['Time'],
title: false
}],
series: [{
type: 'line',
axis: 'left',
xField: 'Time',
yField: 'Value'
}]
}
});
});

James Goddard
17 Feb 2011, 6:17 AM
I am also seeing a hang on this. While the OP's issue may be different, my specific issue is in creating the time axis.

Specificly in the applyData function it returns steps as count - 1. With an empty dataset (which appears to happen no matter what as it either never does or hasn't yet attempted to load the data) count is 0. Therefore steps is -1.

drawAxis then sets delta to trueLength / stepCalcs.steps which becomes a negative number.


while (currentX <= x + gutterX + trueLength) {
...
currentX += delta;
...
}

becomes a hanging loop.

Jamie Avins
17 Feb 2011, 8:22 AM
Interesting, we'll investigate this. Thanks for the report.

James Goddard
17 Feb 2011, 1:40 PM
Just to add a little more information to this. I had a problem with my store so I really had no data.

However the graph shouldn't lock up the browser with no data so it's still an issue. And fixing the data only helped if I preloaded the store (and allowed it to finish) before creating the graph, i.e. I created the graph in the store.load callback.

Also note that this also occurs with a category axis.

Jamie Avins
18 Feb 2011, 4:27 PM
Yes, we noticed that this could happen with an empty store. We're putting in a check to stop this from happening.