diff --git a/apps/spreadsheeteditor/main/app/template/ChartSettings.template b/apps/spreadsheeteditor/main/app/template/ChartSettings.template index c8c2aa068..07abd5929 100644 --- a/apps/spreadsheeteditor/main/app/template/ChartSettings.template +++ b/apps/spreadsheeteditor/main/app/template/ChartSettings.template @@ -24,24 +24,32 @@
- - - - - +
+
+ + +
+ + + + + + + + diff --git a/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js b/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js index 232df0660..86686c789 100644 --- a/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js +++ b/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js @@ -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:
opening price, max price, min price, closing price.' }, SSE.Views.CellRangeDialog || {})) }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettings.js b/apps/spreadsheeteditor/main/app/view/ChartSettings.js index 62d6b32f1..7bfa7e6ba 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettings.js @@ -838,6 +838,12 @@ define([ this.chLastPoint.on('change', _.bind(this.onCheckPointChange, this, 4)); this.chMarkersPoint.on('change', _.bind(this.onCheckPointChange, this, 5)); + 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)); }, @@ -924,6 +930,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; @@ -1186,7 +1234,6 @@ define([ textStock: 'Stock Chart', textStyle: 'Style', textAdvanced: 'Show advanced settings', - strSparkType: 'Type', strSparkColor: 'Color', strLineWeight: 'Line Weight', textMarkers: 'Markers', @@ -1200,7 +1247,10 @@ define([ textFirstPoint: 'First Point', textLastPoint: 'Last Point', strTemplate: 'Template', - textShow: 'Show' + textShow: 'Show', + textType: 'Type', + textSelectData: 'Select Data', + textRanges: 'Data Range' }, SSE.Views.ChartSettings || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 4c6fb82fe..246f55569 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -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.
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:
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:
opening price, max price, min price, closing price.",
- +