Merge branch 'develop' into feature/sparklines

This commit is contained in:
Julia Radzhabova 2016-09-29 12:53:21 +03:00
commit d71a5a777e
4 changed files with 78 additions and 13 deletions

View file

@ -24,24 +24,32 @@
<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>
<tr>
<td class="padding-small" colspan=2>
<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>
</table>
<table cols="1" id="spark-panel-types">
<tr>
<td>
<label class="header"><%= scope.strSparkType %></label>
<label class="header"><%= scope.textType %></label>
</td>
</tr>
<tr>

View file

@ -119,8 +119,12 @@ define([
}
me.inputRange.validation = function(value) {
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

@ -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 || {}));
});

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.",