[SSE] Select data range for charts from the right panel.

This commit is contained in:
Julia Radzhabova 2016-09-29 12:38:39 +03:00
parent 3eb619db31
commit e7ad410744
4 changed files with 77 additions and 11 deletions

View file

@ -24,16 +24,13 @@
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td colspan=2>
<label class="header"><%= scope.textChartType %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="header"><%= scope.textType %></label>
<div id="chart-button-type" style=""></div>
</td>
<td class="padding-small">
<label class="header"><%= scope.textStyle %></label>
<div id="chart-button-style" style=""></div>
</td>
</tr>
@ -42,6 +39,17 @@
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<label class="header"><%= scope.textRanges %></label>
<button type="button" class="btn btn-text-default" id="chart-btn-select-data" style="min-width: 100px; display: block;"><%= scope.textSelectData %></button>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td align="center" colspan=2>
<label class="link" id="chart-advanced-link"><%= scope.textAdvanced %></label>

View file

@ -119,8 +119,12 @@ define([
}
me.inputRange.validation = function(value) {
var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false);
return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.txtInvalidRange : true;
if (me.options.validation) {
return me.options.validation.call(me, value);
} else {
var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false);
return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.txtInvalidRange : true;
}
};
},
@ -173,6 +177,7 @@ define([
textCancel : 'Cancel',
txtEmpty : 'This field is required',
txtInvalidRange: 'ERROR! Invalid cells range',
errorMaxRows: 'ERROR! The maximum number of data series per chart is 255.'
errorMaxRows: 'ERROR! The maximum number of data series per chart is 255.',
errorStockChart: 'Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price.'
}, SSE.Views.CellRangeDialog || {}))
});

View file

@ -303,6 +303,12 @@ define([
}
}, this));
this.btnSelectData = new Common.UI.Button({
el: $('#chart-btn-select-data')
});
this.btnSelectData.on('click', _.bind(this.onSelectData, this));
this.lockedControls.push(this.btnSelectData);
this.linkAdvanced = $('#chart-advanced-link');
$(this.el).on('click', '#chart-advanced-link', _.bind(this.openAdvancedSettings, this));
},
@ -381,6 +387,48 @@ define([
}
},
onSelectData: function() {
var me = this;
if (me.api) {
var props = me.api.asc_getChartObject(),
handlerDlg = function(dlg, result) {
if (result == 'ok') {
props.putRange(dlg.getSettings());
me.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None);
me.api.asc_editChartDrawingObject(props);
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
},
validation = function(value) {
var isvalid;
if (!_.isEmpty(value)) {
isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, true, !props.getInColumns(), me._state.ChartType);
if (isvalid == Asc.c_oAscError.ID.No)
return true;
} else return '';
if (isvalid == Asc.c_oAscError.ID.StockChartError) {
return this.errorStockChart;
} else if (isvalid == Asc.c_oAscError.ID.MaxDataSeriesError) {
return this.errorMaxRows;
}
return this.txtInvalidRange;
};
var win = new SSE.Views.CellRangeDialog({
handler: handlerDlg,
validation: validation
});
win.show();
win.setSettings({
api : me.api,
range : props.getRange()
});
}
},
onSelectType: function(btn, picker, itemView, record) {
if (this._noApply) return;
@ -537,7 +585,10 @@ define([
textPoint: 'XY (Scatter) Chart',
textStock: 'Stock Chart',
textStyle: 'Style',
textAdvanced: 'Show advanced settings'
textAdvanced: 'Show advanced settings',
textType: 'Type',
textSelectData: 'Select Data',
textRanges: 'Data Range'
}, SSE.Views.ChartSettings || {}));
});

View file

@ -130,8 +130,6 @@
"SSE.Controllers.Main.confirmMoveCellRange": "The destination cell range can contain data. Continue the operation?",
"SSE.Controllers.Main.confirmPutMergeRange": "The source data contained merged cells.<br>They had been unmerged before they were pasted into the table.",
"del_SSE.Controllers.Main.convertationErrorText": "Conversion failed.",
"SSE.Controllers.Main.openErrorText": "An error has occurred while opening the file",
"SSE.Controllers.Main.saveErrorText": "An error has occurred while saving the file",
"SSE.Controllers.Main.convertationTimeoutText": "Conversion timeout exceeded.",
"SSE.Controllers.Main.criticalErrorExtText": "Press \"OK\" to return to document list.",
"SSE.Controllers.Main.criticalErrorTitle": "Error",
@ -299,6 +297,7 @@
"SSE.Views.CellEditor.textManager": "Name Manager",
"SSE.Views.CellEditor.tipFormula": "Insert Function",
"SSE.Views.CellRangeDialog.errorMaxRows": "ERROR! The maximum number of data series per chart is 255",
"SSE.Views.CellRangeDialog.errorStockChart": "Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price.",
"SSE.Views.CellRangeDialog.textCancel": "Cancel",
"SSE.Views.CellRangeDialog.txtEmpty": "This field is required",
"SSE.Views.CellRangeDialog.txtInvalidRange": "ERROR! Invalid cells range",
@ -318,6 +317,9 @@
"SSE.Views.ChartSettings.textStock": "Stock Chart",
"SSE.Views.ChartSettings.textStyle": "Style",
"SSE.Views.ChartSettings.textWidth": "Width",
"SSE.Views.ChartSettings.textType": "Type",
"SSE.Views.ChartSettings.textSelectData": "Select Data",
"SSE.Views.ChartSettings.textRanges": "Data Range",
"SSE.Views.ChartSettingsDlg.cancelButtonText": "Cancel",
"SSE.Views.ChartSettingsDlg.errorMaxRows": "ERROR! The maximum number of data series per chart is 255",
"SSE.Views.ChartSettingsDlg.errorStockChart": "Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price.",