Commit 8caed468f0974c7727182c2bc6a1737e8a01dd45

Authored by Benjamin Renard
1 parent 83b95d9c

Fix axes ranges definition for histogram2D

js/app/models/PlotObjects/PlotHistogram2DSerieObject.js
... ... @@ -18,10 +18,6 @@ Ext.define('amdaPlotObj.PlotHistogram2DSerieObject', {
18 18 requires: ['amdaPlotObj.PlotAxisObject'],
19 19 fields : [
20 20 {name: 'serie-xaxis-param', type: 'string'},
21   - {name: 'histo2d-xmin', type:'float', useNull:true},
22   - {name: 'histo2d-xmax', type:'float', useNull:true},
23   - {name: 'histo2d-ymin', type:'float', useNull:true},
24   - {name: 'histo2d-ymax', type:'float', useNull:true},
25 21 {name: 'serie-resampling-mode', type: 'string'},
26 22 {name: 'histo2d-function', type: 'string'},
27 23 {name: 'histotype-param', type: 'string' },
... ... @@ -53,10 +49,6 @@ Ext.define('amdaPlotObj.PlotHistogram2DSerieObject', {
53 49 {
54 50 var serieValues = this.callParent(arguments);
55 51 serieValues['serie-xaxis-param'] = this.get('serie-xaxis-param');
56   - serieValues['histo2d-xmin'] = this.get('histo2d-xmin');
57   - serieValues['histo2d-xmax'] = this.get('histo2d-xmax');
58   - serieValues['histo2d-ymin'] = this.get('histo2d-ymin');
59   - serieValues['histo2d-ymax'] = this.get('histo2d-ymax');
60 52 serieValues['serie-resampling-mode'] = this.get('serie-resampling-mode');
61 53 serieValues['histo2d-function'] = this.get('histo2d-function');
62 54 serieValues['histotype-param'] = this.get('histotype-param');
... ...
js/app/models/PlotObjects/PlotTreeNode.js
... ... @@ -273,6 +273,8 @@ Ext.define('amdaPlotObj.PlotParamTreeNode', {
273 273 type: 'param',
274 274  
275 275 removable: true,
  276 +
  277 + panelObject: null,
276 278  
277 279 getAdditionalText: function()
278 280 {
... ...
js/app/views/PlotComponents/PlotBaseSerieForm.js
... ... @@ -16,7 +16,7 @@ Ext.define('amdaPlotComp.PlotBaseSerieForm', {
16 16 this.loadRecord(this.object);
17 17 this.updateOptions(this.crtTree.getSelectedPlotType());
18 18 },
19   -
  19 +
20 20 updateOptions: function(plotType) {
21 21 var isScatter = (plotType == 'xyPlot');
22 22  
... ...
js/app/views/PlotComponents/PlotElementPanel.js
... ... @@ -40,7 +40,7 @@ Ext.define('amdaPlotComp.PlotElementPanel', {
40 40 elementForm.crtTree = tree;
41 41 if (elementForm.setObject)
42 42 elementForm.setObject(object);
43   - if (elementForm.setParentObject)
  43 + if (elementForm.setParentObject)
44 44 elementForm.setParentObject(parentObject);
45 45 });
46 46 },
... ...
js/app/views/PlotComponents/PlotHistogram2DSerieForm.js
... ... @@ -14,7 +14,12 @@ Ext.define('amdaPlotComp.PlotHistogram2DSerieForm', {
14 14 setObject: function (object) {
15 15 this.callParent(arguments);
16 16 this.updateOptions(this.object.get('histo2d-function'));
17   - },
  17 + },
  18 +
  19 + setParentObject: function (parentObject) {
  20 + this.callParent(arguments);
  21 + this.updateAxesRanges();
  22 + },
18 23  
19 24 updateOptions: function(functionType) {
20 25 var isDensity = (functionType == 'density');
... ... @@ -22,6 +27,16 @@ Ext.define('amdaPlotComp.PlotHistogram2DSerieForm', {
22 27 var zParamField = this.getForm().findField('histotype-param');
23 28 zParamField.setVisible(!isDensity)
24 29 },
  30 +
  31 + updateAxesRanges: function() {
  32 + var xAxisObj = this.parentObject.axes().getById('xaxis_id');
  33 + var yAxisObj = this.parentObject.axes().getById('y-left');
  34 + this.getForm().findField('histo2d-xmin').setValue(xAxisObj.get('axis-range-min'));
  35 + this.getForm().findField('histo2d-xmax').setValue(xAxisObj.get('axis-range-max'));
  36 + this.getForm().findField('histo2d-ymin').setValue(yAxisObj.get('axis-range-min'));
  37 + this.getForm().findField('histo2d-ymax').setValue(yAxisObj.get('axis-range-max'));
  38 + },
  39 +
25 40 getRangeForms: function(){
26 41 var me = this;
27 42 return {
... ... @@ -48,14 +63,22 @@ Ext.define('amdaPlotComp.PlotHistogram2DSerieForm', {
48 63 items:
49 64 [{
50 65 items:[
51   - me.addStandardFloat2('histo2d-xmin', 'X Min'),
52   - me.addStandardFloat2('histo2d-xmax', 'X Max'),
  66 + me.addStandardFloat2('histo2d-xmin', 'X Min', -Number.MAX_VALUE, Number.MAX_VALUE, false, false, function(name, newValue, oldValue){
  67 + me.parentObject.axes().getById('xaxis_id').set('axis-range-min', newValue);
  68 + }),
  69 + me.addStandardFloat2('histo2d-xmax', 'X Max', -Number.MAX_VALUE, Number.MAX_VALUE, false, false, function(name, newValue, oldValue){
  70 + me.parentObject.axes().getById('xaxis_id').set('axis-range-max', newValue);
  71 + }),
53 72 ]
54 73 },
55 74 {
56 75 items:[
57   - me.addStandardFloat2('histo2d-ymin', 'Y Min'),
58   - me.addStandardFloat2('histo2d-ymax', 'Y Max'),
  76 + me.addStandardFloat2('histo2d-ymin', 'Y Min', -Number.MAX_VALUE, Number.MAX_VALUE, false, false, function(name, newValue, oldValue){
  77 + me.parentObject.axes().getById('y-left').set('axis-range-min', newValue);
  78 + }),
  79 + me.addStandardFloat2('histo2d-ymax', 'Y Max', -Number.MAX_VALUE, Number.MAX_VALUE, false, false, function(name, newValue, oldValue){
  80 + me.parentObject.axes().getById('y-left').set('axis-range-max', newValue);
  81 + }),
59 82 ],
60 83 }]
61 84 };
... ... @@ -64,7 +87,6 @@ Ext.define('amdaPlotComp.PlotHistogram2DSerieForm', {
64 87 getFormItems: function() {
65 88 var me = this;
66 89  
67   -
68 90 var histogram2DItems = [
69 91 this.addStandardParamDropTarget('serie-xaxis-param', 'X Parameter', function(name, value, oldValue) {
70 92 me.object.set('serie-xaxis-param', value);
... ...
js/app/views/PlotComponents/PlotParamForm.js
... ... @@ -118,6 +118,8 @@ Ext.define('amdaPlotComp.PlotParamForm', {
118 118 drawingOptionsForm.crtTree = this.crtTree;
119 119 if (drawingOptionsForm.setObject)
120 120 drawingOptionsForm.setObject(this.object);
  121 + if (drawingOptionsForm.setParentObject)
  122 + drawingOptionsForm.setParentObject(this.parentObject);
121 123 if (this.paramArgs && paramId)
122 124 this.paramArgs.editParameter(this.object, this, function (uiScope) {
123 125 uiScope.crtTree.refresh();
... ...