View Full Version : Need realistic chart example

27 Jun 2013, 7:49 PM
I am using ExtJs 4.2.1. All the charts examples in the docs are unrealistic in tha they render directly to a window insider an Ext.onReady() call but no application is like that.

I have a custom panel that goes like this:

Ext.define('MyPanel', {
extend: 'Ext.panel.Panel',
requires: [ 'Ext.chart.*' ],
layout: 'fit',
statics: {
createChartData: function() { ... },
createChartStore: function() { ... },
createChart: function(store) { ... }
initComponent: function() {
this.chartStore = MyPanel.createChartStore();
this.items = MyPanel.createChart(this.chartStore);

where the statics are lifted verbatim from the examples/charts/Area.js and examples/example-data.js code. When I try to run that I get scores and scores of

Error: Problem parsing d="C0,0,0,0,0,0"

or some longer expression in Svg.js. The chart is rendered but the errors are not trivial because I also get lots of:

Uncaught TypeError: undefined is not a function
in Ext.define.getPoint when moving the mouse over the panel tool buttons, errors I don't get if I omit the chart. The example itself works fine. This is with Chrome. In FF I don't get either of these errors but instead I get lots of

TypeError: Ext.util.Point is not a constructor

when mousing over the chart. Does anyone know what is going on?

30 Jun 2013, 5:04 PM
Are you looking to create a real-world application where the chart is embedded in a panel and the data is pulled down from a server/DB?

2 Jul 2013, 5:42 AM
Yes, exactly.

2 Jul 2013, 9:37 AM
that's right

2 Jul 2013, 11:27 AM
I would think that the examples give a good jumping off point, though their stores aren't necessarily what you're looking for - but you can borrow the store config from another example to show how it's constructed.

has the basic structure of creating a chart and inserting it as a child of another panel / window.

has an example of how to set up a store with different read/write urls.

And when it comes to putting it all together into an app I'd recommend checking out these guides:

2 Jul 2013, 12:26 PM
Before I reply can somebody tell me how to stop the forum software from throwing away my blank lines and mashing everything into a single paragraph? Thx.

2 Jul 2013, 1:37 PM
If you're having trouble copying / pasting code from your editor you might try posting it to this site:
and running it through their formatting script before pasting to the forum.

2 Jul 2013, 4:37 PM
Have you looked at my first posting? I know how to include code in this forum. My problem is that when I try to post plain text but in several paragraphs the forum software mashes all the paragraphs into a single blob, i.e., it throws away the blank lines. I do not see in the BB code any equivalent of the HTML