[SSE] Show errors when set combo chart type
This commit is contained in:
parent
5794800988
commit
ca01b519f9
|
@ -204,6 +204,8 @@ define([
|
|||
Common.NotificationCenter.on('goback', _.bind(this.goBack, this));
|
||||
Common.NotificationCenter.on('download:advanced', _.bind(this.onAdvancedOptions, this));
|
||||
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
|
||||
Common.NotificationCenter.on('showerror', _.bind(this.onError, this));
|
||||
|
||||
|
||||
this.isShowOpenDialog = false;
|
||||
|
||||
|
@ -1601,6 +1603,10 @@ define([
|
|||
config.msg = this.errorCompare;
|
||||
break;
|
||||
|
||||
case Asc.c_oAscError.ID.ComboSeriesError:
|
||||
config.msg = this.errorComboSeries;
|
||||
break;
|
||||
|
||||
default:
|
||||
config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id);
|
||||
break;
|
||||
|
@ -2712,7 +2718,8 @@ define([
|
|||
textRemember: 'Remember my choice',
|
||||
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
|
||||
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
||||
saveErrorTextDesktop: 'This file cannot be saved or created.<br>Possible reasons are: <br>1. The file is read-only. <br>2. The file is being edited by other users. <br>3. The disk is full or corrupted.'
|
||||
saveErrorTextDesktop: 'This file cannot be saved or created.<br>Possible reasons are: <br>1. The file is read-only. <br>2. The file is being edited by other users. <br>3. The disk is full or corrupted.',
|
||||
errorComboSeries: 'To create a combination chart, select at least two series of data.'
|
||||
}
|
||||
})(), DE.Controllers.Main || {}))
|
||||
});
|
|
@ -2050,11 +2050,12 @@ define([
|
|||
}
|
||||
|
||||
if (chart) {
|
||||
var props = new Asc.asc_CImgProperty();
|
||||
chart.changeType(type);
|
||||
props.put_ChartProperties(chart);
|
||||
this.api.ImgApply(props);
|
||||
|
||||
var isCombo = (type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
|
||||
type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom);
|
||||
if (isCombo && chart.getSeries().length<2) {
|
||||
Common.NotificationCenter.trigger('showerror', Asc.c_oAscError.ID.ComboSeriesError, Asc.c_oAscError.Level.NoCritical);
|
||||
} else
|
||||
chart.changeType(type);
|
||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||
} else {
|
||||
if (!this.diagramEditor)
|
||||
|
|
|
@ -386,14 +386,17 @@ define([
|
|||
rawData = record;
|
||||
}
|
||||
|
||||
this.btnChartType.setIconCls('svgicon ' + 'chart-' + rawData.iconCls);
|
||||
this._state.ChartType = -1;
|
||||
|
||||
if (this.api && !this._noApply && this.chartProps) {
|
||||
var props = new Asc.asc_CImgProperty();
|
||||
this.chartProps.changeType(rawData.type);
|
||||
props.put_ChartProperties(this.chartProps);
|
||||
this.api.ImgApply(props);
|
||||
var isCombo = (rawData.type==Asc.c_oAscChartTypeSettings.comboBarLine || rawData.type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
|
||||
rawData.type==Asc.c_oAscChartTypeSettings.comboAreaBar || rawData.type==Asc.c_oAscChartTypeSettings.comboCustom);
|
||||
if (isCombo && this.chartProps.getSeries().length<2) {
|
||||
Common.NotificationCenter.trigger('showerror', Asc.c_oAscError.ID.ComboSeriesError, Asc.c_oAscError.Level.NoCritical);
|
||||
this.mnuChartTypePicker.selectRecord(this.mnuChartTypePicker.store.findWhere({type: this.chartProps.getType()}), true);
|
||||
} else {
|
||||
this.btnChartType.setIconCls('svgicon ' + 'chart-' + rawData.iconCls);
|
||||
this._state.ChartType = -1;
|
||||
this.chartProps.changeType(rawData.type);
|
||||
}
|
||||
}
|
||||
this.fireEvent('editcomplete', this);
|
||||
},
|
||||
|
|
|
@ -184,6 +184,7 @@ define([
|
|||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||
Common.NotificationCenter.on('goback', _.bind(this.goBack, this));
|
||||
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
|
||||
Common.NotificationCenter.on('showerror', _.bind(this.onError, this));
|
||||
|
||||
this.isShowOpenDialog = false;
|
||||
|
||||
|
@ -1273,6 +1274,10 @@ define([
|
|||
config.maxwidth = 600;
|
||||
break;
|
||||
|
||||
case Asc.c_oAscError.ID.ComboSeriesError:
|
||||
config.msg = this.errorComboSeries;
|
||||
break;
|
||||
|
||||
default:
|
||||
config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id);
|
||||
break;
|
||||
|
@ -2355,7 +2360,8 @@ define([
|
|||
textRemember: 'Remember my choice',
|
||||
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
|
||||
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
||||
saveErrorTextDesktop: 'This file cannot be saved or created.<br>Possible reasons are: <br>1. The file is read-only. <br>2. The file is being edited by other users. <br>3. The disk is full or corrupted.'
|
||||
saveErrorTextDesktop: 'This file cannot be saved or created.<br>Possible reasons are: <br>1. The file is read-only. <br>2. The file is being edited by other users. <br>3. The disk is full or corrupted.',
|
||||
errorComboSeries: 'To create a combination chart, select at least two series of data.'
|
||||
}
|
||||
})(), PE.Controllers.Main || {}))
|
||||
});
|
||||
|
|
|
@ -1687,17 +1687,19 @@ define([
|
|||
if (selectedElements && _.isArray(selectedElements)) {
|
||||
for (var i = 0; i< selectedElements.length; i++) {
|
||||
if (Asc.c_oAscTypeSelectElement.Chart == selectedElements[i].get_ObjectType()) {
|
||||
chart = true;
|
||||
chart = selectedElements[i].get_ObjectValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (chart) {
|
||||
var props = new Asc.CAscChartProp();
|
||||
props.changeType(type);
|
||||
this.api.ChartApply(props);
|
||||
|
||||
var isCombo = (type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
|
||||
type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom);
|
||||
if (isCombo && chart.get_ChartProperties() && chart.get_ChartProperties().getSeries().length<2) {
|
||||
Common.NotificationCenter.trigger('showerror', Asc.c_oAscError.ID.ComboSeriesError, Asc.c_oAscError.Level.NoCritical);
|
||||
} else
|
||||
chart.changeType(type);
|
||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||
} else {
|
||||
if (!this.diagramEditor)
|
||||
|
|
|
@ -108,8 +108,9 @@ define([
|
|||
this.disableControls(this._locked);
|
||||
|
||||
if (props){
|
||||
this._originalProps = new Asc.CAscChartProp(props);
|
||||
this._originalProps = props;
|
||||
this._noApply = true;
|
||||
this.chartProps = props.get_ChartProperties();
|
||||
|
||||
var value = props.get_SeveralCharts() || this._locked;
|
||||
if (this._state.SeveralCharts!==value) {
|
||||
|
@ -320,13 +321,18 @@ define([
|
|||
rawData = record;
|
||||
}
|
||||
|
||||
this.btnChartType.setIconCls('svgicon ' + 'chart-' + rawData.iconCls);
|
||||
this._state.ChartType = -1;
|
||||
|
||||
if (this.api && !this._noApply) {
|
||||
var props = new Asc.CAscChartProp();
|
||||
props.changeType(rawData.type);
|
||||
this.api.ChartApply(props);
|
||||
var isCombo = (rawData.type==Asc.c_oAscChartTypeSettings.comboBarLine || rawData.type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
|
||||
rawData.type==Asc.c_oAscChartTypeSettings.comboAreaBar || rawData.type==Asc.c_oAscChartTypeSettings.comboCustom);
|
||||
|
||||
if (isCombo && this.chartProps.getSeries().length<2) {
|
||||
Common.NotificationCenter.trigger('showerror', Asc.c_oAscError.ID.ComboSeriesError, Asc.c_oAscError.Level.NoCritical);
|
||||
this.mnuChartTypePicker.selectRecord(this.mnuChartTypePicker.store.findWhere({type: this._originalProps.getType()}), true);
|
||||
} else {
|
||||
this.btnChartType.setIconCls('svgicon ' + 'chart-' + rawData.iconCls);
|
||||
this._state.ChartType = -1;
|
||||
this._originalProps.changeType(rawData.type);
|
||||
}
|
||||
}
|
||||
this.fireEvent('editcomplete', this);
|
||||
},
|
||||
|
|
|
@ -1028,8 +1028,20 @@ define([
|
|||
if (isvalid == Asc.c_oAscError.ID.No) {
|
||||
(ischartedit) ? me.api.asc_editChartDrawingObject(props) : me.api.asc_addChartDrawingObject(props);
|
||||
} else {
|
||||
var msg = me.txtInvalidRange;
|
||||
switch (isvalid) {
|
||||
case isvalid == Asc.c_oAscError.ID.StockChartError:
|
||||
msg = me.errorStockChart;
|
||||
break;
|
||||
case isvalid == Asc.c_oAscError.ID.MaxDataSeriesError:
|
||||
msg = me.errorMaxRows;
|
||||
break;
|
||||
case isvalid == Asc.c_oAscError.ID.ComboSeriesError:
|
||||
msg = me.errorComboSeries;
|
||||
break;
|
||||
}
|
||||
Common.UI.warning({
|
||||
msg: (isvalid == Asc.c_oAscError.ID.StockChartError) ? me.errorStockChart : ((isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) ? me.errorMaxRows : me.txtInvalidRange),
|
||||
msg: msg,
|
||||
callback: function() {
|
||||
_.defer(function(btn) {
|
||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
||||
|
@ -4012,7 +4024,8 @@ define([
|
|||
txtTable_TableStyleLight: 'Table Style Light',
|
||||
textInsert: 'Insert',
|
||||
txtInsertCells: 'Insert Cells',
|
||||
txtDeleteCells: 'Delete Cells'
|
||||
txtDeleteCells: 'Delete Cells',
|
||||
errorComboSeries: 'To create a combination chart, select at least two series of data.'
|
||||
|
||||
}, SSE.Controllers.Toolbar || {}));
|
||||
});
|
|
@ -278,15 +278,21 @@ define([
|
|||
} else {
|
||||
rawData = record;
|
||||
}
|
||||
var isCombo = rawData.type==Asc.c_oAscChartTypeSettings.comboBarLine || rawData.type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
|
||||
rawData.type==Asc.c_oAscChartTypeSettings.comboAreaBar || rawData.type==Asc.c_oAscChartTypeSettings.comboCustom,
|
||||
series = isCombo ? this.chartSettings.getSeries() : [];
|
||||
if (isCombo && series.length<2) {
|
||||
Common.UI.warning({msg: this.errorComboSeries, maxwidth: 600});
|
||||
return;
|
||||
}
|
||||
|
||||
this.btnChartType.setIconCls('svgicon ' + 'chart-' + rawData.iconCls);
|
||||
this.currentChartType = rawData.type;
|
||||
this.chartSettings.changeType(this.currentChartType);
|
||||
this.ShowHideSettings(this.currentChartType);
|
||||
if (this.currentChartType==Asc.c_oAscChartTypeSettings.comboBarLine || this.currentChartType==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
|
||||
this.currentChartType==Asc.c_oAscChartTypeSettings.comboAreaBar || this.currentChartType==Asc.c_oAscChartTypeSettings.comboCustom) {
|
||||
this.updateSeriesList(this.chartSettings.getSeries());
|
||||
} else
|
||||
if (isCombo)
|
||||
this.updateSeriesList(series);
|
||||
else
|
||||
this.updateChartStyles(this.api.asc_getChartPreviews(this.currentChartType));
|
||||
},
|
||||
|
||||
|
@ -437,7 +443,8 @@ define([
|
|||
textStyle: 'Style',
|
||||
textSeries: 'Series',
|
||||
textSecondary: 'Secondary Axis',
|
||||
errorSecondaryAxis: 'The selected chart type requires the secondary axis that an existing chart is using. Select another chart type.'
|
||||
errorSecondaryAxis: 'The selected chart type requires the secondary axis that an existing chart is using. Select another chart type.',
|
||||
errorComboSeries: 'To create a combination chart, select at least two series of data.'
|
||||
|
||||
}, SSE.Views.ChartTypeDialog || {}))
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue