PDA

View Full Version : Line series chart problem with loading data properly



sinethar
12 Aug 2015, 1:22 AM
Hi everyone,
I did a chart with a line representing the progress of a trip. When i am loading the data from the local memory it works properly like seen in the capture : 53015

After i made the loading with ajax request to a json mock data file, it started loading in reverse order the values in the location field and is loading but not rendering the label values for the markers. here is example:
53016

Any ideas . Is this a bug or i am doing something wrong . here is the code for the chart itself:


initComponent: function () {
var me = this;


Ext.apply(me, {
axes: [
{
type: 'Numeric',
minimum: 0,
maximum: 1.2,
position: 'top',
fields: ['dataValue'],
hidden: false
// minorTickSteps: 1
},
{
type: 'Category',
position: 'left',
hidden: false,
fields: ['fromLocation'],
title: 'Location',
minorTickSteps: 0
}
],


series: [
{
type: 'line',


axis: 'left',
xField: 'dataValue',
yField: 'fromLocation',
style: {
fill: '#38B8BF',
'stroke-width': 2
},
highlight: {
size: 11,
radius: 11
},
markerConfig: {
type: 'circle',
size: 9,
radius: 9,
'stroke-width': 2,
stroke: '#38B8BF',
fill: '#FFF',
cursor: 'pointer'
},
label: {
display: 'under',
'text-anchor': 'right',
field: 'fromLocation',




renderer: function (v, label, storeItem, store, i, display, animate, index){
var
me = this,
ets = storeItem.get('ETS'),
eta = storeItem.get('ETA');
//debugger;
if( ! ets ){
if (eta){
return 'ETA:' + eta;
}
}else{
if (!eta){
return 'ETS:'+ ets;
}else{
return 'ETA:' + eta + '\n' + 'ETS:'+ ets
}
}




},
orientation: 'vertical'
}
}
]
});


me.callParent(arguments);


here is also the mock data:


[
{ "fromLocation": "Saragosa",
"dataValue": 0.3,
"ETA": 35
},
{ "fromLocation": "Barcelona",
"dataValue": 0.3,
"ETA": 35,
"ETS": 16
},
{ "fromLocation": "Madrid",
"dataValue": 0.3,
"ETS": 16
}
]


So i would like to load the starting point saragosa at the top (0,0) of the axes and render properly the labels which stopped rendering properly after i did the ajax loading of store

bjdurham85
31 Aug 2015, 12:27 PM
Is the mock data from your local memory or json file?