PDA

View Full Version : Line Chart shows wron Data



Solitaer
18 Jul 2014, 1:40 AM
Hi,

i have a Chart with 4 values:

Month, Act. Year, Last Year, Middle

My Chart:


Ext.applyIf(me, { items: [ { xtype: 'chart', height: 436, width: 696, shadow: true, animate: true, insetPadding: 20, store: 'MyJsonStore', theme: 'Category3', axes: [ { type: 'Category', fields: [ 'Monat' ], title: 'Monat', position: 'bottom' }, { type: 'Numeric', fields: [ 'y' ], title: 'Prozent', maximum: 100, minimum: 0, position: 'left' } ], series: [ { type: 'column', label: { display: 'insideEnd', field: 'y', color: '#333', 'text-anchor': 'middle' }, xField: 'Monat', yField: [ 'AktJahr', 'LastJahr' ], stacked: false }, { type: 'line', title: 'A-Wettbewerb', xField: 'Monat', yField: 'AWett', fill: true, smooth: 3 } ], legend: {
} } ] });


The Line Chart beginns at 0 and ends by 10.

My Store:

{"success":true,"total":1,"data":[{"Monat":"Januar","AktJahr":"40","LastJahr":"42","AWett":"194"},{"Monat":"Februar","AktJahr":"50","LastJahr":"52","AWett":"84"},{"Monat":"März","AktJahr":"80","LastJahr":"62","AWett":"74"},{"Monat":"April","AktJahr":"20","LastJahr":"32","AWett":"64"},{"Monat":"Mai","AktJahr":"30","LastJahr":"12","AWett":"54"},{"Monat":"Juni","AktJahr":"22","LastJahr":"32","AWett":"44"},{"Monat":"Juli","AktJahr":"43","LastJahr":"62","AWett":"34"},{"Monat":"August","AktJahr":"24","LastJahr":"92","AWett":"44"},{"Monat":"September","AktJahr":"19","LastJahr":"2","AWett":"54"},{"Monat":"Oktober","AktJahr":"98","LastJahr":"32","AWett":"64"},{"Monat":"November","AktJahr":"42","LastJahr":"12","AWett":"74"}, {"Monat":"Dezember","AktJahr":"40","LastJahr":"42","AWett":"84"}]}

But the line shows wrong Data.
Pls Help

http://www.foxpoint.de/sencha/chart.png

Solitaer
18 Jul 2014, 1:41 AM
Ext.applyIf(me, { items: [
{
xtype: 'chart',
height: 436,
width: 696,
shadow: true,
animate: true,
insetPadding: 20,
store: 'MyJsonStore',
theme: 'Category3',
axes: [
{
type: 'Category',
fields: [
'Monat'
],
title: 'Monat',
position: 'bottom'
},
{
type: 'Numeric',
fields: [
'y'
],
title: 'Prozent',
maximum: 100,
minimum: 0,
position: 'left'
}
],
series: [
{
type: 'column',
label: {
display: 'insideEnd',
field: 'y',
color: '#333',
'text-anchor': 'middle'
},
xField: 'Monat',
yField: [
'AktJahr',
'LastJahr'
],
stacked: false
},
{
type: 'line',
title: 'A-Wettbewerb',
xField: 'Monat',
yField: 'AWett',
fill: true,
smooth: 3
}
],
legend: {


}
}
]
});

Gary Schlosberg
18 Jul 2014, 7:11 AM
Strange. Can you post your store code?

Solitaer
18 Jul 2014, 7:17 AM
Ext.define('chart.store.MyJsonStore', {
extend: 'Ext.data.Store',

requires: [
'chart.model.MyModel',
'Ext.data.proxy.Ajax',
'Ext.data.reader.Json'
],

constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
autoSync: true,
model: 'chart.model.MyModel',
storeId: 'MyJsonStore',
proxy: {
type: 'ajax',
url: 'php/werte.php',
reader: {
type: 'json',
root: 'data'
}
}
}, cfg)]);
}
});

Solitaer
18 Jul 2014, 7:44 AM
The Problem was, the values of A-Wett was in "" :-?

Thanx!