Blame view

js/app/views/PlotComponents/PlotHistogram2DSerieForm.js 4.21 KB
6e83f9b9   Erdogan Furkan   Done
1
2
3
4
5
6
7
8
9
10
11
12
13
/**
 * Project   : TMA-AMDA
 * Name      : PlotHistogram2DSerieForm.js
 * @class   amdaPlotComp.PlotHistogram2DSerieForm
 * @extends amdaPlotComp.PlotBaseSerieForm
 * @brief   Form to define specifics histogram2d serie options
 * @author  Furkan Erdogan
 * @version $Id: PlotHistogram2DSerieForm.js furkan $
 */

Ext.define('amdaPlotComp.PlotHistogram2DSerieForm', {
	extend: 'amdaPlotComp.PlotBaseSerieForm',

4eb0a428   Benjamin Renard   Set density map a...
14
15
16
	setObject: function (object) {
		this.callParent(arguments);
		this.updateOptions(this.object.get('histo2d-function'));
8caed468   Benjamin Renard   Fix axes ranges d...
17
18
19
20
    },

	setParentObject: function (parentObject) {
		this.callParent(arguments);
0ceb8de8   Benjamin Renard   Add symbolic link...
21
		this.updateAxesRangesAndColourMap(parentObject);
8caed468   Benjamin Renard   Fix axes ranges d...
22
	},
4eb0a428   Benjamin Renard   Set density map a...
23

6e83f9b9   Erdogan Furkan   Done
24
	updateOptions: function(functionType) {
34d92f66   Benjamin Renard   Add normalized de...
25
		var isDensity = (functionType == 'density') || (functionType == 'normdensity');
6e83f9b9   Erdogan Furkan   Done
26
27
28
29

		var zParamField = this.getForm().findField('histotype-param');
		zParamField.setVisible(!isDensity)
	},
8caed468   Benjamin Renard   Fix axes ranges d...
30

0ceb8de8   Benjamin Renard   Add symbolic link...
31
	updateAxesRangesAndColourMap: function(parentObject) {
86e018f7   Benjamin Renard   Fix bug with pare...
32
33
		var xAxisObj = parentObject.axes().getById('xaxis_id');
		var yAxisObj = parentObject.axes().getById('y-left');
0ceb8de8   Benjamin Renard   Add symbolic link...
34
35
		var colorAxisObj = parentObject.axes().getById('color');
		
8caed468   Benjamin Renard   Fix axes ranges d...
36
37
38
39
		this.getForm().findField('histo2d-xmin').setValue(xAxisObj.get('axis-range-min'));
		this.getForm().findField('histo2d-xmax').setValue(xAxisObj.get('axis-range-max'));
		this.getForm().findField('histo2d-ymin').setValue(yAxisObj.get('axis-range-min'));
		this.getForm().findField('histo2d-ymax').setValue(yAxisObj.get('axis-range-max'));
0ceb8de8   Benjamin Renard   Add symbolic link...
40
		this.getForm().findField('histo2d-color-map').setValue(colorAxisObj.get('axis-color-map'));
8caed468   Benjamin Renard   Fix axes ranges d...
41
42
	},

6e83f9b9   Erdogan Furkan   Done
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
	getRangeForms: function(){
		var me = this;
		return {
			xtype: 'fieldset',
			bodyStyle: { background: '#dfe8f6' },
			title: 'X & Y ranges',
			name: 'histo2d-ranges',
			renderTo: Ext.getBody(),
			fieldDefaults: {
				labelAlign: 'right',
				msgTarget: 'side',
				labelWidth: 40,
			},
			defaults: {
				xtype: 'panel',
				bodyStyle: {background: '#dfe8f6'},
				flex: 1,
				border:false,
				layout: 'anchor',
			},
			layout:'hbox',
			frame: true,
			//bodyPadding: '5 5 5 5',
			items: 
			[{
				items:[
8caed468   Benjamin Renard   Fix axes ranges d...
69
70
71
72
73
74
					me.addStandardFloat2('histo2d-xmin', 'X Min', -Number.MAX_VALUE, Number.MAX_VALUE, false, false, function(name, newValue, oldValue){
						me.parentObject.axes().getById('xaxis_id').set('axis-range-min', newValue);
					}),
					me.addStandardFloat2('histo2d-xmax', 'X Max', -Number.MAX_VALUE, Number.MAX_VALUE, false, false, function(name, newValue, oldValue){
						me.parentObject.axes().getById('xaxis_id').set('axis-range-max', newValue);
					}),
6e83f9b9   Erdogan Furkan   Done
75
76
77
78
				]
			},
			{
				items:[
8caed468   Benjamin Renard   Fix axes ranges d...
79
80
81
82
83
84
					me.addStandardFloat2('histo2d-ymin', 'Y Min', -Number.MAX_VALUE, Number.MAX_VALUE, false, false, function(name, newValue, oldValue){
						me.parentObject.axes().getById('y-left').set('axis-range-min', newValue);
					}),
					me.addStandardFloat2('histo2d-ymax', 'Y Max', -Number.MAX_VALUE, Number.MAX_VALUE, false, false, function(name, newValue, oldValue){
						me.parentObject.axes().getById('y-left').set('axis-range-max', newValue);
					}),
6e83f9b9   Erdogan Furkan   Done
85
86
87
88
89
90
91
92
				],
			}]
		};

	},
	getFormItems: function() {
		var me = this;
		
6e83f9b9   Erdogan Furkan   Done
93
94
95
96
97
98
		var histogram2DItems = [
			this.addStandardParamDropTarget('serie-xaxis-param', 'X Parameter', function(name, value, oldValue) {
				me.object.set('serie-xaxis-param', value);
        		me.crtTree.refresh();
			}),
			me.getRangeForms(),
4f728fd9   Erdogan Furkan   For now 2
99
100
			this.addStandardCombo('serie-resampling-mode', 'Reference parameter for resampling', amdaDefaultConfigs.availableResamplingModes),
			this.addStandardCombo('histo2d-function', 'Function to apply', amdaDefaultConfigs.availableHistogram2DFunctions, function(name, value, oldValue) {
6e83f9b9   Erdogan Furkan   Done
101
102
103
104
105
106
107
108
109
				me.object.set('histo2d-function', value);
				me.updateOptions(value);
			}),
			this.addStandardParamDropTarget('histotype-param', 'Z Parameter', function(name, value, oldValue) {
				me.object.set('histotype-param', value);
        		me.crtTree.refresh();
			}),
			this.addStandardInteger('histo2d-xbinnumber', 'X - Nb. of bins'),
			this.addStandardInteger('histo2d-ybinnumber', 'Y - Nb. of bins'),
0ceb8de8   Benjamin Renard   Add symbolic link...
110
111
112
113
			this.addStandardInteger('histo2d-smoothfactor', 'Smooth factor'),
			this.addColorMapCombo('histo2d-color-map', function(name, newValue, oldValue){
				me.parentObject.axes().getById('color').set('axis-color-map', newValue);
			})
6e83f9b9   Erdogan Furkan   Done
114
115
116
117
			
		];
		return histogram2DItems;
	}
4eb0a428   Benjamin Renard   Set density map a...
118
});