How can I draw an stock chart or a line chart with hundreds points? I disabled animation in regular line chart, but not successful and still too heavy and slow.

- 3,401
- 13
- 31
- 46

- 17,114
- 22
- 95
- 173
-
2as far as i tried extjs 4 it all slow and heavy =) – Subdigger Aug 02 '11 at 10:38
-
I was excited about charts in ExtJS 4 too. I used them in one of the projects and then I got too tired of defending it against the "slow and buggy" reports from the users. Finally just switched back to FusionCharts. (The final straw was a serious tooltip related bug that blatantly displayed WRONG data. tooltip intended for one line was being displayed on hover of some other line if the two lines were "close by" ) – Amol Katdare Aug 03 '11 at 17:03
-
We consider switching from ExtJS3+Flot to ExtJS4, but I get more discouraged the more I dive into the details... Has anybody compared flot vs. ExtJS4 charts in terms of features and performance? – Erich Kitzmueller Aug 04 '11 at 13:10
-
If you want to heavily customise the styling of the charts I suggest you steer clear of Ext 4 - there are so many bugs with the rendering and you'll spend all day trying to get it just relatively the same between browsers. (Hopefully some of these will be fixed with 4.1!) – Mark Rhodes Sep 09 '11 at 14:47
5 Answers
I've recently written a blog post on creating stock charts in Ext JS 4 - http://www.scottlogic.co.uk/2011/12/ext-js-4-stock-charts/. It uses a couple of hundred points and performs fine in modern browsers and isn't too bad in IE7-8.
This said however, even after messing with the Ext JS build system, the minimum Ext build required to run the charts is still something like .5MB which is too heavy weight for some applications. The CSS however can be chopped down to just a few rules - if you're willing to spend the time trying to figure out which ones you need out of the huge ext-all.css!

- 10,049
- 4
- 48
- 51
My app is completely Ext-JS based. However, when performance is a problem, I use flot. The API is much better designed (and I'm an Ext-JS fan boy) and it performs much better. This is at the expense of working with raw pixel data (canvas, which is pixel based) if you need to interact with the chart. Since in Ext-JS, everything is an SVG object, you can simply attach event handlers to the lines, or anything else you draw yourself.
For example. For a wave monitor, we use flot. For another chart where we let the user drag and drop some lines on the screen, we use Ext-JS charts.
Here's a simplistic wrapper to use flot as an Ext.Component
Ext.define('cci.view.wavemon.Flot', {
extend: 'Ext.Component',
alias: 'widget.cci-flot',
/**
* @cfg {number[][]} data The data to be drawn when it gets rendered
*/
data: null,
/**
* @cfg {object} flotOptions
* The options to be passed in to $.plot
*/
flotOptions: null,
/**
* @property
* The Flot object used to render the chart and to manipulate it in the future. It will only
* be available after the first resize event
* You may not set this property but you are free to call methods on it
*/
flot: null,
initComponent: function() {
this.callParent(arguments);
// The only time that we're guaranteed to have dimensions is after the first resize event
this.on('resize', function(comp) {
if (!this.flot) {
this.flot = $.plot(this.getTargetEl().dom, this.data, this.flotOptions);
} else {
// Flot knows to look at the containers size and resize itself
this.flot.resize();
}
}, this);
}
});

- 90,375
- 31
- 153
- 217
If you generate extjs code dynamically (php, python, asp.net...) and data source is static - you can easily generate chart to png and load it at ext.panel.

- 2,787
- 1
- 23
- 32
I've found flot (http://code.google.com/p/flot/) to have much better performance with many points / series, whereas the performance of the ExtJS 4 charts was unacceptable. Flot also has a clearer API and reads data in a simple format.

- 93
- 3
- 8
-
I agree with everything, except for the data format. Ext-JS lets you pass any kind of data into a store using a data reader. – Ruan Mendes Nov 14 '11 at 16:34
There's a complete example on how to create stock line charts for Sencha Charts here:
http://dev.sencha.com/deploy/touch-charts-1.0.0/examples/Stock/
As you can see, the example handles > 100 data points easily.
The example is for touch charts, but the API is nearly identical to what's in Sencha's ExtJS 4. Copy and pasting the chart instanciation code should do the work.

- 11
- 1