-
18 Nov 2012 9:50 PM #1
Answered: Lines with different number of points on the same graph
Answered: Lines with different number of points on the same graph
Is it possible to fit on one line graph with a different amount of points?
Something similar to the following algorithm:
chart1.pngPHP Code: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;
}
-
Best Answer Posted by mitchellsimoens
Most definitely:
Code: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 } } ] });
-
20 Nov 2012 10:02 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
Most definitely:
Code: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 } } ] });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
21 Nov 2012 7:39 PM #3
Thank you! I did everything the same. But found the differences. I used the "type":
see Fig.PHP Code: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}
]
});
If not to use it, then everything works.
chart2.pngPHP Code:{name: 'K'}


Reply With Quote