PDA

View Full Version : line chart, multiple series against time



RobertGary1
16 Sep 2013, 6:18 PM
I'm trying to create a chart with 2 series against time. The problem is that I cannot guarantee that each entry in the series will perfectly match against the other with regard to time. So...

axes: [
{
type: 'Time',
fields: [
'time'
],
position: 'bottom',
dateFormat: me.timeHours === true ? 'H:i':'n/j' ,
//groupBy: 'day, hour',
step: me.timeHours === true ? [Ext.Date.HOUR,1]: [Ext.Date.DAY, 2],
},
{
type: 'Numeric',
fields: [
'Read',
'Write'
],
position: 'left',
title:me.yTitle,
}
],
series: [


{
type: 'line',
xField: 'time',
yField: [
'Read'
],
showMarkers: false,
style: {
stroke: '#FF9933',
'stroke-width': 2
}
},
{
type: 'line',
xField: 'time',
yField: [
'Write'
],
showMarkers: false,
style: {
stroke: '#00FF66',
'stroke-width': 1
}


}
]

And given data like...
[{Read:4, time: 2, Write:4, time:3}] etc (yes I made up time)

I've tried using...
[{Read:4, time: 2, Write:false, Write:4, time:3, Read:false}]
but I just get conversion errors and one of the series just doens't show up.

So how can I drop two line series against time if I cannot guarantee that each entry in each series will share a precisely same time stamp?

-Robert

ettavolt
17 Sep 2013, 7:49 AM
You need to interpolate.
Also, object literal should not (or even must not in strict mode) contain several entries of same key - engine will use only one of them, and I don't remember exactly which one.