ResultDataPlot.js
2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Ext.define('treps.controller.Data.Plot.ResultDataPlot', {
extend: 'Ext.app.Controller',
requires : [
'treps.controller.Data.Plot.DataPlotManager'
],
views: [
'Steps.ExportDefinition.ExportDefinitionPanel'
],
refs: [
{
ref: 'dataPlotPanel',
selector: 'data_plot'
},
{
ref: 'rangeSlider',
selector: '#slideRange'
}
],
init: function() {
var me = this;
this.control({
'#nextRange': {
click: me.onNextRange,
scope: me
},
'#prevRange': {
click: me.onPrevRange,
scope: me
},
'#slideRange': {
changecomplete: me.onSlideRange,
scope: me
}
});
},
onNextRange: function() {
var slider = this.getRangeSlider();
var minRec = treps.controller.Data.Plot.DataPlotManager.nextRange();
slider.setValue(minRec);
},
onPrevRange: function() {
var slider = this.getRangeSlider();
var minRec = treps.controller.Data.Plot.DataPlotManager.prevRange();
slider.setValue(minRec);
},
onSlideRange: function(slider, newValue, thumb, eOpts) {
treps.controller.Data.Plot.DataPlotManager.setMin(newValue);
},
reconfigureRangeSlider: function(total)
{
var slider = this.getRangeSlider();
slider.setMinValue(0);
slider.increment = treps.Constants.PLOT_MAX_POINTS;
var maxVal = (total - (total%treps.Constants.PLOT_MAX_POINTS));
slider.setMaxValue(maxVal);
},
reconfigureDataPlot: function(srcVectors, resVectors, srcFrame, dstFrame)
{
var dataPlotMgr = treps.controller.Data.Plot.DataPlotManager;
var plotPanel = this.getDataPlotPanel();
var srcStore = treps.controller.Data.Store.DataStoreManager.getStore('SourceDataStore');
var resStore = treps.controller.Data.Store.DataStoreManager.getStore('ResultDataStore');
var useTime = (treps.model.Session.get('sourceTimeFormat') != "");
dataPlotMgr.reconfigure(plotPanel, treps.Constants.PLOT_MAX_POINTS, srcStore, resStore, srcFrame, dstFrame);
if ((srcVectors.length > 0) && (srcVectors.length != resVectors.length))
{
treps.Messages.showError("Plot data error : Source and result vectors don't have the same length!");
return;
}
this.reconfigureRangeSlider(srcStore.totalCount);
Ext.each(srcVectors, function(srcVector, index)
{
Ext.each(resVectors, function(resVector, index)
{
if (srcVector['id'] == resVector['id'])
{
dataPlotMgr.addPlot(
useTime,
srcVector['id'],
srcVector['comp_1'], srcVector['comp_2'], srcVector['comp_3'],
resVector['comp_1'], resVector['comp_2'], resVector['comp_3']);
}
});
});
if (srcVectors.length == 0)
plotPanel.body.update("No vector to plot");
dataPlotMgr.updateRange();
}
});