PDA

View Full Version : Line Chart issues



lacda97
15 Nov 2013, 9:32 AM
Hi,
I'm new to ExtJS and am running into an issue with the Line Chart display. Somehow, the Line Chart did not display my data correctly from a JSon store even though the Column chart did (from the same store. Attached are the screen capture of what the Line Chart is displayed now, and my code. I'm using ExtJS version 4.2.1.
Can anyone see what's could be wrong?

Thanks,
Lam

scottmartin
15 Nov 2013, 11:49 AM
Chart your svalue data to numeric:



[{
"sDate": "2012-09-12 19:58:20-04",
"sValue": 69352
}, {
"sDate": "2012-09-12 19:58:30-04",
"sValue": 71668
}, {
"sDate": "2012-09-12 19:58:40-04",
"sValue": 74154
}, {
"sDate": "2012-09-12 19:58:50-04",
"sValue": 88655
}, {
"sDate": "2012-09-12 19:59:00-04",
"sValue": 79219
}, {
"sDate": "2012-09-12 19:59:10-04",
"sValue": 90864
}, {
"sDate": "2012-09-12 19:59:20-04",
"sValue": 89506
}, {
"sDate": "2012-09-12 19:59:30-04",
"sValue": 79323
}, {
"sDate": "2012-09-12 19:59:40-04",
"sValue": 92806
}, {
"sDate": "2012-09-12 19:59:50-04",
"sValue": 137666
}]


46879

lacda97
18 Nov 2013, 7:50 AM
Thanks Scott for the response. I'm still unclear.
Do you mean that I should convert the
svalue data to numeric before calling
the "Ext.create('Ext.chart.Chart', { ...)
in addition to specifying the "type: 'Numeric'"
for the "axes" ?

Is that the process that I should follow for all
Line charts since I did not have to do that for the Column chart to
work from the same 'store'?

Thanks,
Lam



Chart your svalue data to numeric:



[{
"sDate": "2012-09-12 19:58:20-04",
"sValue": 69352
}, {
"sDate": "2012-09-12 19:58:30-04",
"sValue": 71668
}, {
"sDate": "2012-09-12 19:58:40-04",
"sValue": 74154
}, {
"sDate": "2012-09-12 19:58:50-04",
"sValue": 88655
}, {
"sDate": "2012-09-12 19:59:00-04",
"sValue": 79219
}, {
"sDate": "2012-09-12 19:59:10-04",
"sValue": 90864
}, {
"sDate": "2012-09-12 19:59:20-04",
"sValue": 89506
}, {
"sDate": "2012-09-12 19:59:30-04",
"sValue": 79323
}, {
"sDate": "2012-09-12 19:59:40-04",
"sValue": 92806
}, {
"sDate": "2012-09-12 19:59:50-04",
"sValue": 137666
}]


46879

scottmartin
18 Nov 2013, 8:02 AM
If you have control over the json, I would simply make it numeric by default.

I agree that both should behave the same, but it seems they do not.

The other option is to adjust your store field if you do not want to change your data.



{ name: 'sValue', type: 'int' }

lacda97
18 Nov 2013, 9:44 AM
I modified the store's model definition to define
the type for 'svalue' data. That works.
The line chart showed correct graph now.

Thanks Scott.
Lam