PDA

View Full Version : Lines with different number of points on the same graph



Radius-Service
18 Nov 2012, 9:50 PM
Is it possible to fit on one line graph with a different amount of points?
Something similar to the following algorithm:


for (i = 0; i <= c; i + +) {
if (i> 5) {
t_data.push ({
'M': t_m,
'N': f1 (t_m),
'P': f2 (t_m)
}); }
else {
t_data.push ({
'M': t_m,
'N': f1 (t_m),
'P': null
}
t_m + = delta;
}
40158

mitchellsimoens
20 Nov 2012, 10:02 AM
Most definitely:


Ext.create('Ext.chart.Chart', {
renderTo : document.body,
width : 1000,
height : 600,
style : 'background:#fff',
animate : true,
store : {
fields : ['name', 'data1', 'data2', 'data3'],
data : [
{
name : 'One',
data1 : 5
},
{
name : 'Two',
data1 : 15,
data2 : 5
},
{
name : 'Three',
data1 : 10,
data2 : 10,
data3 : 14
},
{
name : 'Four',
data2 : 15,
data3 : 0
}
]
},
shadow : true,
theme : 'Category1',
legend : {
position : 'right'
},
axes : [
{
type : 'Numeric',
minimum : 0,
position : 'left',
fields : ['data1', 'data2', 'data3'],
title : 'Number of Hits',
minorTickSteps : 1,
grid : {
odd : {
opacity : 1,
fill : '#ddd',
stroke : '#bbb',
'stroke-width' : 0.5
}
}
},
{
type : 'Category',
position : 'bottom',
fields : ['name'],
title : 'Month of the Year'
}
],
series : [
{
type : 'line',
highlight : {
size : 7,
radius : 7
},
axis : 'left',
smooth : true,
xField : 'name',
yField : 'data1',
markerConfig : {
type : 'cross',
size : 4,
radius : 4,
'stroke-width' : 0
}
},
{
type : 'line',
highlight : {
size : 7,
radius : 7
},
axis : 'left',
smooth : true,
xField : 'name',
yField : 'data2',
markerConfig : {
type : 'circle',
size : 4,
radius : 4,
'stroke-width' : 0
}
},
{
type : 'line',
highlight : {
size : 7,
radius : 7
},
axis : 'left',
smooth : true,
xField : 'name',
yField : 'data3',
markerConfig : {
type : 'circle',
size : 4,
radius : 4,
'stroke-width' : 0
}
}
]
});

Radius-Service
21 Nov 2012, 7:39 PM
Thank you! I did everything the same. But found the differences. I used the "type":

Ext.define('vReportsProductsSN.tab_5.chart.model', {
extend: 'Ext.data.Model',
fields: [
{name: 'M', type: 'float', useNull: true},
{name: 'N', type: 'float', useNull: true},
{name: 'P', type: 'float', useNull: true},
{name: 'K', type: 'float', useNull: true}
]
});
see Fig.
If not to use it, then everything works.

{name: 'K'}

40235