Merge pull request #1565 from ONLYOFFICE/feature/sse-switch-rowcol

Feature/sse switch rowcol
This commit is contained in:
Julia Radzhabova 2022-02-14 16:10:21 +03:00 committed by GitHub
commit ee15a53547
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 43 additions and 2 deletions

View file

@ -40,6 +40,11 @@
<div id="chart-btn-select-data" style="width:100%;"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="chart-btn-switch" style="width:100%;"></div>
</td>
</tr>
</table>
<table cols="1" id="spark-panel-types">
<tr>

View file

@ -222,6 +222,10 @@ define([
this.btnRatio.toggle(value);
this._state.keepRatio=value;
}
var chartSettings = this.api.asc_getChartObject(),
series = chartSettings ? chartSettings.getSeries() : null;
this.btnSwitch.setDisabled(!series || series.length<1 || !chartSettings || !chartSettings.getRange());
} else { //sparkline
this._originalProps = props;
this.isChart = false;
@ -774,6 +778,19 @@ define([
this.btnSelectData.on('click', _.bind(this.onSelectData, this));
this.lockedControls.push(this.btnSelectData);
this.btnSwitch = new Common.UI.Button({
parentEl: $('#chart-btn-switch'),
cls : 'btn-toolbar',
iconCls : 'toolbar__icon switch_row_column',
caption : this.textSwitch,
style : 'width: 100%;text-align: left;',
dataHint : '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.btnSwitch.on('click', _.bind(this.onSwitch, this));
this.lockedControls.push(this.btnSwitch);
this.linkAdvanced = $('#chart-advanced-link');
$(this.el).on('click', '#chart-advanced-link', _.bind(this.openAdvancedSettings, this));
},
@ -1247,7 +1264,22 @@ define([
}
Common.NotificationCenter.trigger('edit:complete', this);
},
onSwitch: function() {
if (this.api){
var props = this.api.asc_getChartObject();
if (props) {
props.startEdit();
var res = props.switchRowCol();
if (res === Asc.c_oAscError.ID.MaxDataSeriesError) {
props.cancelEdit();
Common.UI.warning({msg: this.errorMaxRows, maxwidth: 600});
} else
props.endEdit();
}
}
},
setLocked: function (locked) {
this._locked = locked;
},
@ -1286,7 +1318,9 @@ define([
textSelectData: 'Select Data',
textRanges: 'Data Range',
textBorderSizeErr: 'The entered value is incorrect.<br>Please enter a value between 0 pt and 1584 pt.',
textChangeType: 'Change type'
textChangeType: 'Change type',
textSwitch: 'Switch Row/Column',
errorMaxRows: 'The maximum number of data series per chart is 255.'
}, SSE.Views.ChartSettings || {}));
});

View file

@ -1601,6 +1601,8 @@
"SSE.Views.ChartSettings.textStyle": "Style",
"SSE.Views.ChartSettings.textType": "Type",
"SSE.Views.ChartSettings.textWidth": "Width",
"SSE.Views.ChartSettings.textSwitch": "Switch Row/Column",
"SSE.Views.ChartSettings.errorMaxRows": "The maximum number of data series per chart is 255.",
"SSE.Views.ChartSettingsDlg.errorMaxPoints": "ERROR! The maximum number of points in series per chart is 4096.",
"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.",

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B