[SSE] Refactoring chart range settings
This commit is contained in:
parent
f5dc20d8d0
commit
5fa4da93b4
|
@ -136,8 +136,8 @@ define([
|
||||||
name : 'range',
|
name : 'range',
|
||||||
style : 'width: 100%;',
|
style : 'width: 100%;',
|
||||||
btnHint : this.textSelectData,
|
btnHint : this.textSelectData,
|
||||||
allowBlank : true,
|
allowBlank : true
|
||||||
validateOnChange: true
|
// validateOnChange: true
|
||||||
});
|
});
|
||||||
this.txtDataRange.on('button:click', _.bind(this.onSelectData, this));
|
this.txtDataRange.on('button:click', _.bind(this.onSelectData, this));
|
||||||
this.txtDataRange.on('changed:after', function(input, newValue, oldValue, e) {
|
this.txtDataRange.on('changed:after', function(input, newValue, oldValue, e) {
|
||||||
|
@ -192,7 +192,7 @@ define([
|
||||||
this.btnSwitch = new Common.UI.Button({
|
this.btnSwitch = new Common.UI.Button({
|
||||||
el: $('#chart-dlg-btn-switch')
|
el: $('#chart-dlg-btn-switch')
|
||||||
});
|
});
|
||||||
// this.btnSwitch.on('click', _.bind(this.onSwitch, this));
|
this.btnSwitch.on('click', _.bind(this.onSwitch, this));
|
||||||
|
|
||||||
this.categoryList = new Common.UI.ListView({
|
this.categoryList = new Common.UI.ListView({
|
||||||
el: $('#chart-dlg-category-list', this.$window),
|
el: $('#chart-dlg-category-list', this.$window),
|
||||||
|
@ -403,14 +403,7 @@ define([
|
||||||
me = this;
|
me = this;
|
||||||
var handlerDlg = function(dlg, result) {
|
var handlerDlg = function(dlg, result) {
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
// var changedValue = dlg.getSettings();
|
rec.set('value', series.asc_getSeriesName());
|
||||||
// series.asc_setName(changedValue.name);
|
|
||||||
// if (isScatter) {
|
|
||||||
// series.asc_setXValues(changedValue.valuesX);
|
|
||||||
// series.asc_setYValues(changedValue.valuesY);
|
|
||||||
// } else {
|
|
||||||
// series.asc_setValues(changedValue.valuesX);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// me.setStartPointHistory();
|
// me.setStartPointHistory();
|
||||||
|
@ -422,8 +415,7 @@ define([
|
||||||
var me = this;
|
var me = this;
|
||||||
var handlerDlg = function(dlg, result) {
|
var handlerDlg = function(dlg, result) {
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
// var changedValue = dlg.getSettings();
|
me.updateCategoryList(me.chartSettings.getCatValues());
|
||||||
// me.chartSettings.setCatFormula(changedValue.name);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// me.setStartPointHistory();
|
// me.setStartPointHistory();
|
||||||
|
@ -481,7 +473,7 @@ define([
|
||||||
var item = series[i],
|
var item = series[i],
|
||||||
rec = new Common.UI.DataViewModel();
|
rec = new Common.UI.DataViewModel();
|
||||||
rec.set({
|
rec.set({
|
||||||
value: item.getSeriesName(),
|
value: item.asc_getSeriesName(),
|
||||||
index: item.asc_getIdx(),
|
index: item.asc_getIdx(),
|
||||||
order: item.asc_getOrder(),
|
order: item.asc_getOrder(),
|
||||||
series: item
|
series: item
|
||||||
|
@ -508,6 +500,13 @@ define([
|
||||||
(len>0) && this.categoryList.selectByIndex(0);
|
(len>0) && this.categoryList.selectByIndex(0);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onSwitch: function() {
|
||||||
|
this.chartSettings.switchRowCol();
|
||||||
|
this.updateSeriesList(this.chartSettings.getSeries(), 0);
|
||||||
|
this.updateCategoryList(this.chartSettings.getCatValues());
|
||||||
|
this.updateButtons();
|
||||||
|
},
|
||||||
|
|
||||||
textTitle: 'Chart Data',
|
textTitle: 'Chart Data',
|
||||||
txtEmpty: 'This field is required',
|
txtEmpty: 'This field is required',
|
||||||
textInvalidRange: 'ERROR! Invalid cells range',
|
textInvalidRange: 'ERROR! Invalid cells range',
|
||||||
|
|
|
@ -128,7 +128,7 @@ define([
|
||||||
el: $('#id-dlg-chart-range-range1'),
|
el: $('#id-dlg-chart-range-range1'),
|
||||||
style: '100%',
|
style: '100%',
|
||||||
textSelectData: 'Select data',
|
textSelectData: 'Select data',
|
||||||
validateOnChange: true,
|
// validateOnChange: true,
|
||||||
validateOnBlur: false
|
validateOnBlur: false
|
||||||
}).on('changed:after', function(input, newValue, oldValue, e) {
|
}).on('changed:after', function(input, newValue, oldValue, e) {
|
||||||
if (newValue == oldValue) return;
|
if (newValue == oldValue) return;
|
||||||
|
@ -143,7 +143,7 @@ define([
|
||||||
el: $('#id-dlg-chart-range-range2'),
|
el: $('#id-dlg-chart-range-range2'),
|
||||||
style: '100%',
|
style: '100%',
|
||||||
textSelectData: 'Select data',
|
textSelectData: 'Select data',
|
||||||
validateOnChange: true,
|
// validateOnChange: true,
|
||||||
validateOnBlur: false
|
validateOnBlur: false
|
||||||
}).on('changed:after', function(input, newValue, oldValue, e) {
|
}).on('changed:after', function(input, newValue, oldValue, e) {
|
||||||
if (newValue == oldValue) return;
|
if (newValue == oldValue) return;
|
||||||
|
@ -158,7 +158,7 @@ define([
|
||||||
el: $('#id-dlg-chart-range-range3'),
|
el: $('#id-dlg-chart-range-range3'),
|
||||||
style: '100%',
|
style: '100%',
|
||||||
textSelectData: 'Select data',
|
textSelectData: 'Select data',
|
||||||
validateOnChange: true,
|
// validateOnChange: true,
|
||||||
validateOnBlur: false
|
validateOnBlur: false
|
||||||
}).on('changed:after', function(input, newValue, oldValue, e) {
|
}).on('changed:after', function(input, newValue, oldValue, e) {
|
||||||
if (newValue == oldValue) return;
|
if (newValue == oldValue) return;
|
||||||
|
@ -191,23 +191,25 @@ define([
|
||||||
if (this.props.series) {
|
if (this.props.series) {
|
||||||
var series = this.props.series;
|
var series = this.props.series;
|
||||||
this.inputRange1.setValue(series.asc_getName());
|
this.inputRange1.setValue(series.asc_getName());
|
||||||
(this.inputRange1.getValue()!=='') && this.lblRange1.html('= ' + series.getName());
|
this.lblRange1.html((this.inputRange1.getValue()!=='') ? ('= ' + (series.asc_getNameVal() || '')) : this.txtChoose);
|
||||||
if (this.props.isScatter) {
|
if (this.props.isScatter) {
|
||||||
|
var arr = series.asc_getXValuesArr();
|
||||||
this.inputRange2.setValue(series.asc_getXValues());
|
this.inputRange2.setValue(series.asc_getXValues());
|
||||||
(this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getXValuesArr().join('; '));
|
this.lblRange2.html((this.inputRange2.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose);
|
||||||
this.inputRange3.setValue(series.asc_getYValues());
|
|
||||||
(this.inputRange3.getValue()!=='') && this.lblRange3.html('= ' + series.asc_getYValuesArr().join('; '));
|
|
||||||
} else {
|
|
||||||
this.inputRange2.setValue(series.asc_getValues());
|
|
||||||
(this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getValuesArr().join('; '));
|
|
||||||
}
|
|
||||||
} else { // add series
|
|
||||||
|
|
||||||
|
this.inputRange3.setValue(series.asc_getYValues());
|
||||||
|
arr = series.asc_getYValuesArr();
|
||||||
|
this.lblRange3.html((this.inputRange3.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose);
|
||||||
|
} else {
|
||||||
|
var arr = series.asc_getValuesArr();
|
||||||
|
this.inputRange2.setValue(series.asc_getValues());
|
||||||
|
this.lblRange2.html((this.inputRange2.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
var arr = this.props.values;
|
||||||
this.inputRange1.setValue(this.props.category || '');
|
this.inputRange1.setValue(this.props.category || '');
|
||||||
// if (this.inputRange1.getValue()!=='')
|
this.lblRange1.html((this.inputRange1.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose);
|
||||||
this.props.values && this.lblRange1.html('= ' + this.props.values.join('; '));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -276,27 +278,29 @@ define([
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 1:
|
case 1:
|
||||||
series.asc_setName(value);
|
series.asc_setName(value);
|
||||||
(this.inputRange1.getValue()!=='') && this.lblRange1.html('= ' + series.getName());
|
this.lblRange1.html((this.inputRange1.getValue()!=='') ? ('= ' + (series.asc_getNameVal() || '')) : this.txtChoose);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (this.isScatter) {
|
if (this.isScatter) {
|
||||||
|
var arr = series.asc_getXValuesArr();
|
||||||
series.asc_setXValues(value);
|
series.asc_setXValues(value);
|
||||||
(this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getXValuesArr().join('; '));
|
this.lblRange2.html((this.inputRange2.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose);
|
||||||
} else {
|
} else {
|
||||||
|
var arr = series.asc_getValuesArr();
|
||||||
series.asc_setValues(value);
|
series.asc_setValues(value);
|
||||||
(this.inputRange2.getValue()!=='') && this.lblRange2.html('= ' + series.asc_getValuesArr().join('; '));
|
this.lblRange2.html((this.inputRange2.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
var arr = series.asc_getYValuesArr();
|
||||||
series.asc_setYValues(value);
|
series.asc_setYValues(value);
|
||||||
(this.inputRange3.getValue()!=='') && this.lblRange3.html('= ' + series.asc_getYValuesArr().join('; '));
|
this.lblRange3.html((this.inputRange3.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// this.chartSettings.setCatFormula(value);
|
// this.chartSettings.setCatFormula(value);
|
||||||
var values = this.chartSettings.getCatValues();
|
var arr = this.chartSettings.getCatValues();
|
||||||
// if (this.inputRange1.getValue()!=='')
|
this.lblRange1.html((this.inputRange1.getValue()!=='') ? ('= ' + (arr ? arr.join('; ') : '')) : this.txtChoose);
|
||||||
values && this.lblRange1.html('= ' + values.join('; '));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue