diff --git a/apps/common/main/lib/component/DataView.js b/apps/common/main/lib/component/DataView.js index 9a44423f0..d26baa762 100644 --- a/apps/common/main/lib/component/DataView.js +++ b/apps/common/main/lib/component/DataView.js @@ -200,11 +200,12 @@ define([ allowScrollbar: true, scrollAlwaysVisible: false, showLast: true, - useBSKeydown: false + useBSKeydown: false, + cls: '' }, template: _.template([ - '
- + | + | |||
+ + + | ++ + + | +
- + | - + | |
- + | - + | |
- + | - + |
- - + |
- + + |
- + | - + |
+ | ||
- + | ++ | +|
+ + | ++ + | +
+ + | +|
+ + + | ++ + + | +
+ + | ++ + | ++ + | +
+ + | ++ + | ++ + | +
+ + | ++ + | ++ + | +
+ + | +
+ + + | +
+ + | +|
+ + + | ++ + + | +
+ + | +|
+ + | ++ | +
+ + | ++ |
- + | + | |||
+ + + | ++ + + | +
- + | - + |
+ | - + | ++ | |
- + | + |
- + | - + |
- + |
- + | - + | ||
- + | + + + | -- + |
+ + | +|
+ + + | ++ + + | +
+ + | ++ + | ++ + | +
+ + | ++ + | +|
+ + | +
+ + | +|
+ + + | ++ + + | +
+ + | +|
+ + | ++ | +
+ + | +|
+ + + | ++ + + | +
+ + | +|
+ + + |
diff --git a/apps/spreadsheeteditor/main/app/template/ToolbarAnother.template b/apps/spreadsheeteditor/main/app/template/ToolbarAnother.template
index 611aab6f4..49f6f8b27 100644
--- a/apps/spreadsheeteditor/main/app/template/ToolbarAnother.template
+++ b/apps/spreadsheeteditor/main/app/template/ToolbarAnother.template
@@ -31,6 +31,7 @@
+
diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettings.js b/apps/spreadsheeteditor/main/app/view/ChartSettings.js
index e205fb0de..3b588cf58 100644
--- a/apps/spreadsheeteditor/main/app/view/ChartSettings.js
+++ b/apps/spreadsheeteditor/main/app/view/ChartSettings.js
@@ -47,7 +47,8 @@ define([
'common/main/lib/component/MetricSpinner',
'common/main/lib/component/ComboDataView',
'spreadsheeteditor/main/app/view/ChartSettingsDlg',
- 'spreadsheeteditor/main/app/view/ChartDataDialog'
+ 'spreadsheeteditor/main/app/view/ChartDataDialog',
+ 'spreadsheeteditor/main/app/view/ChartTypeDialog'
], function (menuTemplate, $, _, Backbone) {
'use strict';
@@ -112,6 +113,7 @@ define([
this.ChartTypesContainer = $('#chart-panel-types');
this.SparkTypesContainer = $('#spark-panel-types');
this.SparkPointsContainer = $('#spark-panel-points');
+ this.NotCombinedSettings = $('.not-combined');
},
render: function () {
@@ -151,21 +153,11 @@ define([
}
value = props.asc_getSeveralChartTypes();
- if (this._state.SeveralCharts && value) {
- this.btnChartType.setIconCls('svgicon');
- this._state.ChartType = null;
- } else {
- var type = this.chartProps.getType();
- if (this._state.ChartType !== type) {
- var record = this.mnuChartTypePicker.store.findWhere({type: type});
- this.mnuChartTypePicker.selectRecord(record, true);
- if (record) {
- this.btnChartType.setIconCls('svgicon ' + 'chart-' + record.get('iconCls'));
- } else
- this.btnChartType.setIconCls('svgicon');
- this.updateChartStyles(this.api.asc_getChartPreviews(type));
- this._state.ChartType = type;
- }
+ var type = (this._state.SeveralCharts && value) ? null : this.chartProps.getType();
+ if (this._state.ChartType !== type) {
+ this.ShowCombinedProps(type);
+ (type !== null) && this.updateChartStyles(this.api.asc_getChartPreviews(type));
+ this._state.ChartType = type;
}
value = props.asc_getSeveralChartStyles();
@@ -599,32 +591,6 @@ define([
createDelayedControls: function() {
var me = this;
- // charts
- this.btnChartType = new Common.UI.Button({
- cls : 'btn-large-dataview',
- iconCls : 'svgicon chart-bar-normal',
- menu : new Common.UI.Menu({
- style: 'width: 364px; padding-top: 12px;',
- items: [
- { template: _.template('') }
- ]
- })
- });
-
- this.btnChartType.on('render:after', function(btn) {
- me.mnuChartTypePicker = new Common.UI.DataView({
- el: $('#id-chart-menu-type'),
- parentMenu: btn.menu,
- restoreHeight: 421,
- groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()),
- store: new Common.UI.DataViewStore(Common.define.chartData.getChartData()),
- itemTemplate: _.template('')
- });
- });
- this.btnChartType.render($('#chart-button-type'));
- this.mnuChartTypePicker.on('item:click', _.bind(this.onSelectType, this, this.btnChartType));
- this.lockedControls.push(this.btnChartType);
-
this.spnWidth = new Common.UI.MetricSpinner({
el: $('#chart-spin-width'),
step: .1,
@@ -756,8 +722,22 @@ define([
this.chLastPoint.on('change', _.bind(this.onCheckPointChange, this, 4));
this.chMarkersPoint.on('change', _.bind(this.onCheckPointChange, this, 5));
+ this.btnChangeType = new Common.UI.Button({
+ parentEl: $('#chart-btn-change-type'),
+ cls : 'btn-toolbar',
+ iconCls : 'toolbar__icon btn-menu-chart',
+ caption : this.textChangeType,
+ style : 'width: 100%;text-align: left;'
+ });
+ this.btnChangeType.on('click', _.bind(this.onChangeType, this));
+ this.lockedControls.push(this.btnChangeType);
+
this.btnSelectData = new Common.UI.Button({
- el: $('#chart-btn-select-data')
+ parentEl: $('#chart-btn-select-data'),
+ cls : 'btn-toolbar',
+ iconCls : 'toolbar__icon btn-select-range',
+ caption : this.textSelectData,
+ style : 'width: 100%;text-align: left;'
});
this.btnSelectData.on('click', _.bind(this.onSelectData, this));
this.lockedControls.push(this.btnSelectData);
@@ -780,6 +760,11 @@ define([
this.SparkPointsContainer.toggleClass('settings-hidden', isChart);
},
+ ShowCombinedProps: function(type) {
+ this.NotCombinedSettings.toggleClass('settings-hidden', type===null || type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
+ type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom);
+ },
+
onWidthChange: function(field, newValue, oldValue, eOpts){
var w = field.getNumberValue();
var h = this.spnHeight.getNumberValue();
@@ -924,35 +909,36 @@ define([
}
},
- onSelectType: function(btn, picker, itemView, record) {
- if (this._noApply) return;
-
- var rawData = {},
- isPickerSelect = _.isFunction(record.toJSON);
-
- if (isPickerSelect){
- if (record.get('selected')) {
- rawData = record.toJSON();
- } else {
- // record deselected
- return;
+ onChangeType: function() {
+ var me = this;
+ var props;
+ if (me.api){
+ props = me.api.asc_getChartObject();
+ if (props) {
+ me._isEditType = true;
+ props.startEdit();
+ var win = new SSE.Views.ChartTypeDialog({
+ chartSettings: props,
+ api: me.api,
+ handler: function(result, value) {
+ if (result == 'ok') {
+ props.endEdit();
+ if (me.api) {
+ me.api.asc_editChartDrawingObject(value.chartSettings);
+ }
+ me._isEditType = false;
+ }
+ Common.NotificationCenter.trigger('edit:complete', me);
+ }
+ }).on('close', function() {
+ me._isEditType && props.cancelEdit();
+ me._isEditType = false;
+ });
+ win.show();
}
- } else {
- 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.asc_putChartProperties(this.chartProps);
- this.api.asc_setGraphicObjectProps(props);
- }
- Common.NotificationCenter.trigger('edit:complete', this);
},
-
+
onSelectStyle: function(combo, record) {
if (this._noApply) return;
@@ -1259,7 +1245,8 @@ define([
textType: 'Type',
textSelectData: 'Select Data',
textRanges: 'Data Range',
- textBorderSizeErr: 'The entered value is incorrect.Please enter a value between 0 pt and 1584 pt.' + textBorderSizeErr: 'The entered value is incorrect. Please enter a value between 0 pt and 1584 pt.', + textChangeType: 'Change type' }, SSE.Views.ChartSettings || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js index 87c1851d6..c32f5e47b 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js @@ -43,7 +43,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' 'common/main/lib/component/CheckBox', 'common/main/lib/component/InputField', 'spreadsheeteditor/main/app/view/CellRangeDialog', - 'spreadsheeteditor/main/app/view/ChartDataRangeDialog' + 'spreadsheeteditor/main/app/view/ChartDataRangeDialog', + 'spreadsheeteditor/main/app/view/FormatSettingsDialog' ], function (contentTemplate) { 'use strict'; @@ -62,7 +63,9 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' {panelId: 'id-chart-settings-dlg-style', panelCaption: this.textType}, {panelId: 'id-chart-settings-dlg-layout', panelCaption: this.textLayout}, {panelId: 'id-chart-settings-dlg-vert', panelCaption: this.textVertAxis}, + {panelId: 'id-chart-settings-dlg-vert-sec', panelCaption: this.textVertAxisSec}, {panelId: 'id-chart-settings-dlg-hor', panelCaption: this.textHorAxis}, + {panelId: 'id-chart-settings-dlg-hor-sec', panelCaption: this.textHorAxisSec}, {panelId: 'id-spark-settings-dlg-style', panelCaption: this.textTypeData}, {panelId: 'id-spark-settings-dlg-axis', panelCaption: this.textAxisOptions}, {panelId: 'id-chart-settings-dlg-snap', panelCaption: this.textSnap}, @@ -97,9 +100,9 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.sparklineStyles = this.options.sparklineStyles; this.isChart = this.options.isChart; this.isDiagramMode = !!this.options.isDiagramMode; - this.vertAxisProps = null; - this.horAxisProps = null; - this.currentAxisProps = null; + this.vertAxisProps = []; + this.horAxisProps = []; + this.currentAxisProps = []; this.dataRangeValid = ''; this.sparkDataRangeValid = ''; this.dataLocationRangeValid = ''; @@ -117,17 +120,17 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' if (this.isDiagramMode) { this.btnChartType = new Common.UI.Button({ - cls : 'btn-large-dataview', - iconCls : 'svgicon chart-bar-normal', - menu : new Common.UI.Menu({ + cls: 'btn-large-dataview', + iconCls: 'svgicon chart-bar-normal', + menu: new Common.UI.Menu({ style: 'width: 364px; padding-top: 12px;', additionalAlign: this.menuAddAlign, items: [ - { template: _.template('') } + {template: _.template('')} ] }) }); - this.btnChartType.on('render:after', function(btn) { + this.btnChartType.on('render:after', function (btn) { me.mnuChartTypePicker = new Common.UI.DataView({ el: $('#id-chart-dlg-menu-type'), parentMenu: btn.menu, @@ -141,163 +144,47 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.mnuChartTypePicker.on('item:click', _.bind(this.onSelectType, this, this.btnChartType)); } - // this.cmbDataDirect = new Common.UI.ComboBox({ - // el : $('#chart-dlg-combo-range'), - // menuStyle : 'min-width: 120px;', - // editable : false, - // cls : 'input-group-nr', - // data : [ - // { value: 0, displayValue: this.textDataRows }, - // { value: 1, displayValue: this.textDataColumns } - // ] - // }); - // - // this.txtDataRange = new Common.UI.InputFieldBtn({ - // el : $('#chart-dlg-txt-range'), - // name : 'range', - // style : 'width: 100%;', - // btnHint : this.textSelectData, - // allowBlank : true, - // validateOnChange: true - // }); - // this.txtDataRange.on('button:click', _.bind(this.onSelectData, this)); - this.cmbChartTitle = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-chart-title'), - menuStyle : 'min-width: 140px;', - editable : false, - cls : 'input-group-nr', - data : [ - { value: Asc.c_oAscChartTitleShowSettings.none, displayValue: this.textNone }, - { value: Asc.c_oAscChartTitleShowSettings.overlay, displayValue: this.textOverlay }, - { value: Asc.c_oAscChartTitleShowSettings.noOverlay, displayValue: this.textNoOverlay } + el: $('#chart-dlg-combo-chart-title'), + menuStyle: 'min-width: 140px;', + editable: false, + cls: 'input-group-nr', + data: [ + {value: Asc.c_oAscChartTitleShowSettings.none, displayValue: this.textNone}, + {value: Asc.c_oAscChartTitleShowSettings.overlay, displayValue: this.textOverlay}, + {value: Asc.c_oAscChartTitleShowSettings.noOverlay, displayValue: this.textNoOverlay} ], takeFocusOnClose: true }); this.cmbLegendPos = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-legend-pos'), - menuStyle : 'min-width: 140px;', - editable : false, - cls : 'input-group-nr', - data : [ - { value: Asc.c_oAscChartLegendShowSettings.none, displayValue: this.textNone }, - { value: Asc.c_oAscChartLegendShowSettings.bottom, displayValue: this.textLegendBottom }, - { value: Asc.c_oAscChartLegendShowSettings.top, displayValue: this.textLegendTop }, - { value: Asc.c_oAscChartLegendShowSettings.right, displayValue: this.textLegendRight }, - { value: Asc.c_oAscChartLegendShowSettings.left, displayValue: this.textLegendLeft }, - { value: Asc.c_oAscChartLegendShowSettings.leftOverlay, displayValue: this.textLeftOverlay }, - { value: Asc.c_oAscChartLegendShowSettings.rightOverlay, displayValue: this.textRightOverlay } + el: $('#chart-dlg-combo-legend-pos'), + menuStyle: 'min-width: 140px;', + editable: false, + cls: 'input-group-nr', + data: [ + {value: Asc.c_oAscChartLegendShowSettings.none, displayValue: this.textNone}, + {value: Asc.c_oAscChartLegendShowSettings.bottom, displayValue: this.textLegendBottom}, + {value: Asc.c_oAscChartLegendShowSettings.top, displayValue: this.textLegendTop}, + {value: Asc.c_oAscChartLegendShowSettings.right, displayValue: this.textLegendRight}, + {value: Asc.c_oAscChartLegendShowSettings.left, displayValue: this.textLegendLeft}, + {value: Asc.c_oAscChartLegendShowSettings.leftOverlay, displayValue: this.textLeftOverlay}, + {value: Asc.c_oAscChartLegendShowSettings.rightOverlay, displayValue: this.textRightOverlay} ], takeFocusOnClose: true }); - this.cmbHorTitle = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-hor-title'), - menuStyle : 'min-width: 140px;', - editable : false, - cls : 'input-group-nr', - data : [ - { value: Asc.c_oAscChartHorAxisLabelShowSettings.none, displayValue: this.textNone }, - { value: Asc.c_oAscChartHorAxisLabelShowSettings.noOverlay, displayValue: this.textNoOverlay } - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.chartSettings) - this.chartSettings.putHorAxisLabel(record.value); - }, this)); - - this.cmbVertTitle = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-vert-title'), - menuStyle : 'min-width: 140px;', - editable : false, - cls : 'input-group-nr', - data : [ - { value: Asc.c_oAscChartVertAxisLabelShowSettings.none, displayValue: this.textNone }, - { value: Asc.c_oAscChartVertAxisLabelShowSettings.rotated, displayValue: this.textRotated }, - { value: Asc.c_oAscChartVertAxisLabelShowSettings.horizontal, displayValue: this.textHorizontal } - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.chartSettings) - this.chartSettings.putVertAxisLabel(record.value); - }, this)); - - this.cmbHorShow = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-hor-show'), - menuStyle : 'min-width: 140px;', - editable : false, - cls : 'input-group-nr', - data : [ - { value: true, displayValue: this.textShow }, - { value: false, displayValue: this.textHide } - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.chartSettings) - this.chartSettings.putShowHorAxis(record.value); - }, this)); - - this.cmbVertShow = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-vert-show'), - menuStyle : 'min-width: 140px;', - editable : false, - cls : 'input-group-nr', - data : [ - { value: true, displayValue: this.textShow }, - { value: false, displayValue: this.textHide } - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.chartSettings) - this.chartSettings.putShowVerAxis(record.value); - }, this)); - - this.cmbHorGrid = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-hor-grid'), - menuStyle : 'min-width: 140px;', - editable : false, - cls : 'input-group-nr', - data : [ - { value: Asc.c_oAscGridLinesSettings.none, displayValue: this.textNone }, - { value: Asc.c_oAscGridLinesSettings.major, displayValue: this.textMajor }, - { value: Asc.c_oAscGridLinesSettings.minor, displayValue: this.textMinor }, - { value: Asc.c_oAscGridLinesSettings.majorMinor, displayValue: this.textMajorMinor } - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.chartSettings) - this.chartSettings.putHorGridLines(record.value); - }, this)); - - this.cmbVertGrid = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-vert-grid'), - menuStyle : 'min-width: 140px;', - editable : false, - cls : 'input-group-nr', - data : [ - { value: Asc.c_oAscGridLinesSettings.none, displayValue: this.textNone }, - { value: Asc.c_oAscGridLinesSettings.major, displayValue: this.textMajor }, - { value: Asc.c_oAscGridLinesSettings.minor, displayValue: this.textMinor }, - { value: Asc.c_oAscGridLinesSettings.majorMinor, displayValue: this.textMajorMinor } - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.chartSettings) - this.chartSettings.putVertGridLines(record.value); - }, this)); - this.cmbDataLabels = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-data-labels'), - menuStyle : 'min-width: 140px;', - editable : false, - cls : 'input-group-nr', - data : [ - { value: Asc.c_oAscChartDataLabelsPos.none, displayValue: this.textNone }, - { value: Asc.c_oAscChartDataLabelsPos.ctr, displayValue: this.textCenter }, - { value: Asc.c_oAscChartDataLabelsPos.inBase, displayValue: this.textInnerBottom }, - { value: Asc.c_oAscChartDataLabelsPos.inEnd, displayValue: this.textInnerTop }, - { value: Asc.c_oAscChartDataLabelsPos.outEnd, displayValue: this.textOuterTop } + el: $('#chart-dlg-combo-data-labels'), + menuStyle: 'min-width: 140px;', + editable: false, + cls: 'input-group-nr', + data: [ + {value: Asc.c_oAscChartDataLabelsPos.none, displayValue: this.textNone}, + {value: Asc.c_oAscChartDataLabelsPos.ctr, displayValue: this.textCenter}, + {value: Asc.c_oAscChartDataLabelsPos.inBase, displayValue: this.textInnerBottom}, + {value: Asc.c_oAscChartDataLabelsPos.inEnd, displayValue: this.textInnerTop}, + {value: Asc.c_oAscChartDataLabelsPos.outEnd, displayValue: this.textOuterTop} ], takeFocusOnClose: true }); @@ -305,11 +192,11 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.cmbDataLabels.on('selected', _.bind(me.onSelectDataLabels, this)); this.txtSeparator = new Common.UI.InputField({ - el : $('#chart-dlg-txt-separator'), - name : 'range', - style : 'width: 100%;', - allowBlank : true, - blankError : this.txtEmpty + el: $('#chart-dlg-txt-separator'), + name: 'range', + style: 'width: 100%;', + allowBlank: true, + blankError: this.txtEmpty }); this.chSeriesName = new Common.UI.CheckBox({ @@ -328,432 +215,559 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' }); this.cmbLines = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-lines'), - menuStyle : 'min-width: 140px;', - editable : false, - cls : 'input-group-nr', - data : [ - { value: 0, displayValue: this.textNone }, - { value: 1, displayValue: this.textStraight }, - { value: 2, displayValue: this.textSmooth } + el: $('#chart-dlg-combo-lines'), + menuStyle: 'min-width: 140px;', + editable: false, + cls: 'input-group-nr', + data: [ + {value: 0, displayValue: this.textNone}, + {value: 1, displayValue: this.textStraight}, + {value: 2, displayValue: this.textSmooth} ], takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { + }).on('selected', _.bind(function (combo, record) { if (this.chartSettings) { - this.chartSettings.putLine(record.value!==0); - if (record.value>0) - this.chartSettings.putSmooth(record.value==2); + this.chartSettings.putLine(record.value !== 0); + if (record.value > 0) + this.chartSettings.putSmooth(record.value == 2); } }, this)); this.chMarkers = new Common.UI.CheckBox({ el: $('#chart-dlg-check-markers'), labelText: this.textMarkers - }).on('change', _.bind(function(checkbox, state) { - if (this.chartSettings) - this.chartSettings.putShowMarker(state=='checked'); + }).on('change', _.bind(function (checkbox, state) { + if (this.chartSettings) + this.chartSettings.putShowMarker(state == 'checked'); }, this)); this.lblLines = $('#chart-dlg-label-lines'); // Vertical Axis + this.cmbMinType = []; + this.spnMinValue = []; + this.cmbMaxType = []; + this.spnMaxValue = []; + this.cmbVCrossType = []; + this.spnVAxisCrosses = []; + this.cmbUnits = []; + this.chVReverse = []; + this.cmbVMajorType = []; + this.cmbVMinorType = []; + this.cmbVLabelPos = []; + this.cmbVertTitle = []; + this.cmbVertGrid = []; + this.chVertHide = []; + this.btnVFormat = []; - this.cmbMinType = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-mintype'), - cls : 'input-group-nr', - menuStyle : 'min-width: 100px;', - editable : false, - data : [ - {displayValue: this.textAuto, value: Asc.c_oAscValAxisRule.auto}, - {displayValue: this.textFixed, value: Asc.c_oAscValAxisRule.fixed} - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.currentAxisProps) { - this.currentAxisProps.putMinValRule(record.value); - if (record.value==Asc.c_oAscValAxisRule.auto) { - this.spnMinValue.setValue(this._originalAxisVValues.minAuto, true); + var addControlsV = function(i) { + me.chVertHide[i] = new Common.UI.CheckBox({ + el: $('#chart-dlg-chk-vert-hide-' + i), + labelText: me.textHideAxis + }).on('change', _.bind(function (checkbox, state) { + if (me.currentAxisProps[i]) + me.currentAxisProps[i].putShow(state !== 'checked'); + }, me)); + + me.cmbVertTitle[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-vert-title-' + i), + menuStyle: 'min-width: 140px;', + editable: false, + cls: 'input-group-nr', + data: [ + {value: Asc.c_oAscChartVertAxisLabelShowSettings.none, displayValue: me.textNone}, + {value: Asc.c_oAscChartVertAxisLabelShowSettings.rotated, displayValue: me.textRotated}, + {value: Asc.c_oAscChartVertAxisLabelShowSettings.horizontal, displayValue: me.textHorizontal} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) + me.currentAxisProps[i].putLabel(record.value); + }, me)); + + me.cmbVertGrid[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-vert-grid-' + i), + menuStyle: 'min-width: 140px;', + editable: false, + cls: 'input-group-nr', + data: [ + {value: Asc.c_oAscGridLinesSettings.none, displayValue: me.textNone}, + {value: Asc.c_oAscGridLinesSettings.major, displayValue: me.textMajor}, + {value: Asc.c_oAscGridLinesSettings.minor, displayValue: me.textMinor}, + {value: Asc.c_oAscGridLinesSettings.majorMinor, displayValue: me.textMajorMinor} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) + me.currentAxisProps[i].putGridlines(record.value); + }, me)); + + me.cmbMinType[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-mintype-' + i), + cls: 'input-group-nr', + menuStyle: 'min-width: 100px;', + editable: false, + data: [ + {displayValue: me.textAuto, value: Asc.c_oAscValAxisRule.auto}, + {displayValue: me.textFixed, value: Asc.c_oAscValAxisRule.fixed} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putMinValRule(record.value); + if (record.value == Asc.c_oAscValAxisRule.auto) { + me.spnMinValue[i].setValue(me._originalAxisVValues[i].minAuto, true); + } } - } - }, this)); + }, me)); - this.spnMinValue = new Common.UI.MetricSpinner({ - el : $('#chart-dlg-input-min-value'), - maxValue : 1000000, - minValue : -1000000, - step : 0.1, - defaultUnit : "", - defaultValue : 0, - value : '' - }).on('change', _.bind(function(field, newValue, oldValue) { - this.cmbMinType.suspendEvents(); - this.cmbMinType.setValue(Asc.c_oAscValAxisRule.fixed); - this.cmbMinType.resumeEvents(); - if (this.currentAxisProps) { - this.currentAxisProps.putMinValRule(Asc.c_oAscValAxisRule.fixed); - this.currentAxisProps.putMinVal(field.getNumberValue()); - } - }, this)); - - this.cmbMaxType = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-maxtype'), - cls : 'input-group-nr', - menuStyle : 'min-width: 100px;', - editable : false, - data : [ - {displayValue: this.textAuto, value: Asc.c_oAscValAxisRule.auto}, - {displayValue: this.textFixed, value: Asc.c_oAscValAxisRule.fixed} - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.currentAxisProps) { - this.currentAxisProps.putMaxValRule(record.value); - if (record.value==Asc.c_oAscValAxisRule.auto) { - this.spnMaxValue.setValue(this._originalAxisVValues.maxAuto, true); + me.spnMinValue[i] = new Common.UI.MetricSpinner({ + el: $('#chart-dlg-input-min-value-' + i), + maxValue: 1000000, + minValue: -1000000, + step: 0.1, + defaultUnit: "", + defaultValue: 0, + value: '' + }).on('change', _.bind(function (field, newValue, oldValue) { + me.cmbMinType[i].suspendEvents(); + me.cmbMinType[i].setValue(Asc.c_oAscValAxisRule.fixed); + me.cmbMinType[i].resumeEvents(); + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putMinValRule(Asc.c_oAscValAxisRule.fixed); + me.currentAxisProps[i].putMinVal(field.getNumberValue()); } - } - }, this)); + }, me)); - this.spnMaxValue = new Common.UI.MetricSpinner({ - el : $('#chart-dlg-input-max-value'), - maxValue : 1000000, - minValue : -1000000, - step : 0.1, - defaultUnit : "", - defaultValue : 0, - value : '' - }).on('change', _.bind(function(field, newValue, oldValue) { - this.cmbMaxType.suspendEvents(); - this.cmbMaxType.setValue(Asc.c_oAscValAxisRule.fixed); - this.cmbMaxType.resumeEvents(); - if (this.currentAxisProps) { - this.currentAxisProps.putMaxValRule(Asc.c_oAscValAxisRule.fixed); - this.currentAxisProps.putMaxVal(field.getNumberValue()); - } - }, this)); - - this.cmbVCrossType = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-v-crosstype'), - cls : 'input-group-nr', - menuStyle : 'min-width: 100px;', - editable : false, - data : [ - {displayValue: this.textAuto, value: Asc.c_oAscCrossesRule.auto}, - {displayValue: this.textValue, value: Asc.c_oAscCrossesRule.value}, - {displayValue: this.textMinValue, value: Asc.c_oAscCrossesRule.minValue}, - {displayValue: this.textMaxValue, value: Asc.c_oAscCrossesRule.maxValue} - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.currentAxisProps) { - this.currentAxisProps.putCrossesRule(record.value); - var value; - switch (record.value) { - case Asc.c_oAscCrossesRule.minValue: - this.spnVAxisCrosses.setValue(this.spnMinValue.getNumberValue(), true); - break; - case Asc.c_oAscCrossesRule.maxValue: - this.spnVAxisCrosses.setValue(this.spnMaxValue.getNumberValue(), true); - break; - case Asc.c_oAscCrossesRule.auto: - this.spnVAxisCrosses.setValue(this._originalAxisVValues.crossesAuto, true); - break; + me.cmbMaxType[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-maxtype-' + i), + cls: 'input-group-nr', + menuStyle: 'min-width: 100px;', + editable: false, + data: [ + {displayValue: me.textAuto, value: Asc.c_oAscValAxisRule.auto}, + {displayValue: me.textFixed, value: Asc.c_oAscValAxisRule.fixed} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putMaxValRule(record.value); + if (record.value == Asc.c_oAscValAxisRule.auto) { + me.spnMaxValue[i].setValue(me._originalAxisVValues[i].maxAuto, true); + } } - } - }, this)); + }, me)); - this.spnVAxisCrosses = new Common.UI.MetricSpinner({ - el : $('#chart-dlg-input-v-axis-crosses'), - maxValue : 1000000, - minValue : -1000000, - step : 0.1, - defaultUnit : "", - defaultValue : 0, - value : '' - }).on('change', _.bind(function(field, newValue, oldValue) { - this.cmbVCrossType.suspendEvents(); - this.cmbVCrossType.setValue(Asc.c_oAscCrossesRule.value); - this.cmbVCrossType.resumeEvents(); - if (this.currentAxisProps) { - this.currentAxisProps.putCrossesRule(Asc.c_oAscCrossesRule.value); - this.currentAxisProps.putCrosses(field.getNumberValue()); - } - }, this)); + me.spnMaxValue[i] = new Common.UI.MetricSpinner({ + el: $('#chart-dlg-input-max-value-' + i), + maxValue: 1000000, + minValue: -1000000, + step: 0.1, + defaultUnit: "", + defaultValue: 0, + value: '' + }).on('change', _.bind(function (field, newValue, oldValue) { + me.cmbMaxType[i].suspendEvents(); + me.cmbMaxType[i].setValue(Asc.c_oAscValAxisRule.fixed); + me.cmbMaxType[i].resumeEvents(); + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putMaxValRule(Asc.c_oAscValAxisRule.fixed); + me.currentAxisProps[i].putMaxVal(field.getNumberValue()); + } + }, me)); - this.cmbUnits = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-units'), - cls : 'input-group-nr', - menuStyle : 'min-width: 140px;', - editable : false, - data : [ - {displayValue: this.textNone, value: Asc.c_oAscValAxUnits.none}, - {displayValue: this.textHundreds, value: Asc.c_oAscValAxUnits.HUNDREDS}, - {displayValue: this.textThousands, value: Asc.c_oAscValAxUnits.THOUSANDS}, - {displayValue: this.textTenThousands, value: Asc.c_oAscValAxUnits.TEN_THOUSANDS}, - {displayValue: this.textHundredThousands, value: Asc.c_oAscValAxUnits.HUNDRED_THOUSANDS}, - {displayValue: this.textMillions, value: Asc.c_oAscValAxUnits.MILLIONS}, - {displayValue: this.textTenMillions, value: Asc.c_oAscValAxUnits.TEN_MILLIONS}, - {displayValue: this.textHundredMil, value: Asc.c_oAscValAxUnits.HUNDRED_MILLIONS}, - {displayValue: this.textBillions, value: Asc.c_oAscValAxUnits.BILLIONS}, - {displayValue: this.textTrillions, value: Asc.c_oAscValAxUnits.TRILLIONS} - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.currentAxisProps) { - this.currentAxisProps.putDispUnitsRule(record.value); - } - }, this)); + me.cmbVCrossType[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-v-crosstype-' + i), + cls: 'input-group-nr', + menuStyle: 'min-width: 100px;', + editable: false, + data: [ + {displayValue: me.textAuto, value: Asc.c_oAscCrossesRule.auto}, + {displayValue: me.textValue, value: Asc.c_oAscCrossesRule.value}, + {displayValue: me.textMinValue, value: Asc.c_oAscCrossesRule.minValue}, + {displayValue: me.textMaxValue, value: Asc.c_oAscCrossesRule.maxValue} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putCrossesRule(record.value); + var value; + switch (record.value) { + case Asc.c_oAscCrossesRule.minValue: + me.spnVAxisCrosses[i].setValue(me.spnMinValue.getNumberValue(), true); + break; + case Asc.c_oAscCrossesRule.maxValue: + me.spnVAxisCrosses[i].setValue(me.spnMaxValue.getNumberValue(), true); + break; + case Asc.c_oAscCrossesRule.auto: + me.spnVAxisCrosses[i].setValue(me._originalAxisVValues[i].crossesAuto, true); + break; + } + } + }, me)); - this.chVReverse = new Common.UI.CheckBox({ - el: $('#chart-dlg-check-v-reverse'), - labelText: this.textReverse - }).on('change', _.bind(function(checkbox, state) { - if (this.currentAxisProps) { - this.currentAxisProps.putInvertValOrder(state == 'checked'); - } - }, this)); - - this.cmbVMajorType = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-v-major-type'), - cls : 'input-group-nr', - menuStyle : 'min-width: 140px;', - editable : false, - data : [ - {displayValue: this.textNone, value: Asc.c_oAscTickMark.TICK_MARK_NONE}, - {displayValue: this.textCross, value: Asc.c_oAscTickMark.TICK_MARK_CROSS}, - {displayValue: this.textIn, value: Asc.c_oAscTickMark.TICK_MARK_IN}, - {displayValue: this.textOut, value: Asc.c_oAscTickMark.TICK_MARK_OUT} - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.currentAxisProps) { - this.currentAxisProps.putMajorTickMark(record.value); - } - }, this)); + me.spnVAxisCrosses[i] = new Common.UI.MetricSpinner({ + el: $('#chart-dlg-input-v-axis-crosses-' + i), + maxValue: 1000000, + minValue: -1000000, + step: 0.1, + defaultUnit: "", + defaultValue: 0, + value: '' + }).on('change', _.bind(function (field, newValue, oldValue) { + me.cmbVCrossType[i].suspendEvents(); + me.cmbVCrossType[i].setValue(Asc.c_oAscCrossesRule.value); + me.cmbVCrossType[i].resumeEvents(); + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putCrossesRule(Asc.c_oAscCrossesRule.value); + me.currentAxisProps[i].putCrosses(field.getNumberValue()); + } + }, me)); - this.cmbVMinorType = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-v-minor-type'), - cls : 'input-group-nr', - menuStyle : 'min-width: 140px;', - editable : false, - data : [ - {displayValue: this.textNone, value: Asc.c_oAscTickMark.TICK_MARK_NONE}, - {displayValue: this.textCross, value: Asc.c_oAscTickMark.TICK_MARK_CROSS}, - {displayValue: this.textIn, value: Asc.c_oAscTickMark.TICK_MARK_IN}, - {displayValue: this.textOut, value: Asc.c_oAscTickMark.TICK_MARK_OUT} - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.currentAxisProps) { - this.currentAxisProps.putMinorTickMark(record.value); - } - }, this)); + me.cmbUnits[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-units-' + i), + cls: 'input-group-nr', + menuStyle: 'min-width: 140px;', + editable: false, + data: [ + {displayValue: me.textNone, value: Asc.c_oAscValAxUnits.none}, + {displayValue: me.textHundreds, value: Asc.c_oAscValAxUnits.HUNDREDS}, + {displayValue: me.textThousands, value: Asc.c_oAscValAxUnits.THOUSANDS}, + {displayValue: me.textTenThousands, value: Asc.c_oAscValAxUnits.TEN_THOUSANDS}, + {displayValue: me.textHundredThousands, value: Asc.c_oAscValAxUnits.HUNDRED_THOUSANDS}, + {displayValue: me.textMillions, value: Asc.c_oAscValAxUnits.MILLIONS}, + {displayValue: me.textTenMillions, value: Asc.c_oAscValAxUnits.TEN_MILLIONS}, + {displayValue: me.textHundredMil, value: Asc.c_oAscValAxUnits.HUNDRED_MILLIONS}, + {displayValue: me.textBillions, value: Asc.c_oAscValAxUnits.BILLIONS}, + {displayValue: me.textTrillions, value: Asc.c_oAscValAxUnits.TRILLIONS} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putDispUnitsRule(record.value); + } + }, me)); - this.cmbVLabelPos = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-v-label-pos'), - cls : 'input-group-nr', - menuStyle : 'min-width: 140px;', - editable : false, - data : [ - {displayValue: this.textNone, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE}, - {displayValue: this.textLow, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_LOW}, - {displayValue: this.textHigh, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_HIGH}, - {displayValue: this.textNextToAxis, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO} - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.currentAxisProps) { - this.currentAxisProps.putTickLabelsPos(record.value); - } - }, this)); + me.chVReverse[i] = new Common.UI.CheckBox({ + el: $('#chart-dlg-check-v-reverse-' + i), + labelText: me.textReverse + }).on('change', _.bind(function (checkbox, state) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putInvertValOrder(state == 'checked'); + } + }, me)); + + me.cmbVMajorType[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-v-major-type-' + i), + cls: 'input-group-nr', + menuStyle: 'min-width: 140px;', + editable: false, + data: [ + {displayValue: me.textNone, value: Asc.c_oAscTickMark.TICK_MARK_NONE}, + {displayValue: me.textCross, value: Asc.c_oAscTickMark.TICK_MARK_CROSS}, + {displayValue: me.textIn, value: Asc.c_oAscTickMark.TICK_MARK_IN}, + {displayValue: me.textOut, value: Asc.c_oAscTickMark.TICK_MARK_OUT} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putMajorTickMark(record.value); + } + }, me)); + + me.cmbVMinorType[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-v-minor-type-' + i), + cls: 'input-group-nr', + menuStyle: 'min-width: 140px;', + editable: false, + data: [ + {displayValue: me.textNone, value: Asc.c_oAscTickMark.TICK_MARK_NONE}, + {displayValue: me.textCross, value: Asc.c_oAscTickMark.TICK_MARK_CROSS}, + {displayValue: me.textIn, value: Asc.c_oAscTickMark.TICK_MARK_IN}, + {displayValue: me.textOut, value: Asc.c_oAscTickMark.TICK_MARK_OUT} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putMinorTickMark(record.value); + } + }, me)); + + me.cmbVLabelPos[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-v-label-pos-' + i), + cls: 'input-group-nr', + menuStyle: 'min-width: 100%;', + editable: false, + data: [ + {displayValue: me.textNone, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE}, + {displayValue: me.textLow, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_LOW}, + {displayValue: me.textHigh, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_HIGH}, + {displayValue: me.textNextToAxis, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putTickLabelsPos(record.value); + } + }, me)); + + me.btnVFormat[i] = new Common.UI.Button({ + el: $('#chart-dlg-btn-v-format-' + i) + }).on('click', _.bind(me.openFormat, me, i)); + }; + addControlsV(0); + addControlsV(1); // Horizontal Axis + this.cmbHCrossType = []; + this.cmbAxisPos = []; + this.spnHAxisCrosses = []; + this.chHReverse = []; + this.cmbHMajorType = []; + this.cmbHMinorType = []; + this.spnMarksInterval = []; + this.cmbHLabelPos = []; + this.spnLabelDist = []; + this.cmbLabelInterval = []; + this.spnLabelInterval = []; + this.cmbHorTitle = []; + this.cmbHorGrid = []; + this.chHorHide = []; + this.btnHFormat = []; - this.cmbHCrossType = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-h-crosstype'), - cls : 'input-group-nr', - menuStyle : 'min-width: 100px;', - editable : false, - data : [ - {displayValue: this.textAuto, value: Asc.c_oAscCrossesRule.auto}, - {displayValue: this.textValue, value: Asc.c_oAscCrossesRule.value}, - {displayValue: this.textMinValue, value: Asc.c_oAscCrossesRule.minValue}, - {displayValue: this.textMaxValue, value: Asc.c_oAscCrossesRule.maxValue} - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.currentAxisProps) { - this.currentAxisProps.putCrossesRule(record.value); - if (record.value==Asc.c_oAscCrossesRule.auto) { - this.spnHAxisCrosses.setValue(this._originalAxisHValues.crossesAuto, true); - } else if (record.value==Asc.c_oAscCrossesRule.minValue) { - this.spnHAxisCrosses.setValue(this._originalAxisHValues.minAuto, true); - } else if (record.value==Asc.c_oAscCrossesRule.maxValue) { - this.spnHAxisCrosses.setValue(this._originalAxisHValues.maxAuto, true); + var addControlsH = function(i) { + me.chHorHide[i] = new Common.UI.CheckBox({ + el: $('#chart-dlg-chk-hor-hide-' + i), + labelText: me.textHideAxis + }).on('change', _.bind(function (checkbox, state) { + if (me.currentAxisProps[i]) + me.currentAxisProps[i].putShow(state !== 'checked'); + }, me)); + + me.cmbHorTitle[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-hor-title-' + i), + menuStyle: 'min-width: 140px;', + editable: false, + cls: 'input-group-nr', + data: [ + {value: Asc.c_oAscChartHorAxisLabelShowSettings.none, displayValue: me.textNone}, + {value: Asc.c_oAscChartHorAxisLabelShowSettings.noOverlay, displayValue: me.textNoOverlay} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) + me.currentAxisProps[i].putLabel(record.value); + }, me)); + + me.cmbHorGrid[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-hor-grid-' + i), + menuStyle: 'min-width: 140px;', + editable: false, + cls: 'input-group-nr', + data: [ + {value: Asc.c_oAscGridLinesSettings.none, displayValue: me.textNone}, + {value: Asc.c_oAscGridLinesSettings.major, displayValue: me.textMajor}, + {value: Asc.c_oAscGridLinesSettings.minor, displayValue: me.textMinor}, + {value: Asc.c_oAscGridLinesSettings.majorMinor, displayValue: me.textMajorMinor} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) + me.currentAxisProps[i].putGridlines(record.value); + }, me)); + + me.cmbHCrossType[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-h-crosstype-' + i), + cls: 'input-group-nr', + menuStyle: 'min-width: 100px;', + editable: false, + data: [ + {displayValue: me.textAuto, value: Asc.c_oAscCrossesRule.auto}, + {displayValue: me.textValue, value: Asc.c_oAscCrossesRule.value}, + {displayValue: me.textMinValue, value: Asc.c_oAscCrossesRule.minValue}, + {displayValue: me.textMaxValue, value: Asc.c_oAscCrossesRule.maxValue} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putCrossesRule(record.value); + if (record.value == Asc.c_oAscCrossesRule.auto) { + me.spnHAxisCrosses[i].setValue(me._originalAxisHValues[i].crossesAuto, true); + } else if (record.value == Asc.c_oAscCrossesRule.minValue) { + me.spnHAxisCrosses[i].setValue(me._originalAxisHValues[i].minAuto, true); + } else if (record.value == Asc.c_oAscCrossesRule.maxValue) { + me.spnHAxisCrosses[i].setValue(me._originalAxisHValues[i].maxAuto, true); + } } - } - }, this)); + }, me)); - this.spnHAxisCrosses = new Common.UI.MetricSpinner({ - el : $('#chart-dlg-input-h-axis-crosses'), - maxValue : 1000000, - minValue : -1000000, - step : 0.1, - defaultUnit : "", - defaultValue : 0, - value : '' - }).on('change', _.bind(function(field, newValue, oldValue) { - this.cmbHCrossType.suspendEvents(); - this.cmbHCrossType.setValue(Asc.c_oAscCrossesRule.value); - this.cmbHCrossType.resumeEvents(); - if (this.currentAxisProps) { - this.currentAxisProps.putCrossesRule(Asc.c_oAscCrossesRule.value); - this.currentAxisProps.putCrosses(field.getNumberValue()); - } - }, this)); + me.spnHAxisCrosses[i] = new Common.UI.MetricSpinner({ + el: $('#chart-dlg-input-h-axis-crosses-' + i), + maxValue: 1000000, + minValue: -1000000, + step: 0.1, + defaultUnit: "", + defaultValue: 0, + value: '' + }).on('change', _.bind(function (field, newValue, oldValue) { + me.cmbHCrossType[i].suspendEvents(); + me.cmbHCrossType[i].setValue(Asc.c_oAscCrossesRule.value); + me.cmbHCrossType[i].resumeEvents(); + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putCrossesRule(Asc.c_oAscCrossesRule.value); + me.currentAxisProps[i].putCrosses(field.getNumberValue()); + } + }, me)); - this.cmbAxisPos = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-axis-pos'), - cls : 'input-group-nr', - menuStyle : 'min-width: 140px;', - editable : false, - data : [ - {displayValue: this.textOnTickMarks, value: Asc.c_oAscLabelsPosition.byDivisions}, - {displayValue: this.textBetweenTickMarks, value: Asc.c_oAscLabelsPosition.betweenDivisions} - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.currentAxisProps) { - this.currentAxisProps.putLabelsPosition(record.value); - } - }, this)); + me.cmbAxisPos[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-axis-pos-' + i), + cls: 'input-group-nr', + menuStyle: 'min-width: 140px;', + editable: false, + data: [ + {displayValue: me.textOnTickMarks, value: Asc.c_oAscLabelsPosition.byDivisions}, + {displayValue: me.textBetweenTickMarks, value: Asc.c_oAscLabelsPosition.betweenDivisions} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putLabelsPosition(record.value); + } + }, me)); - this.chHReverse = new Common.UI.CheckBox({ - el: $('#chart-dlg-check-h-reverse'), - labelText: this.textReverse - }).on('change', _.bind(function(checkbox, state) { - if (this.currentAxisProps) { - this.currentAxisProps.putInvertCatOrder(state == 'checked'); - } - }, this)); + me.chHReverse[i] = new Common.UI.CheckBox({ + el: $('#chart-dlg-check-h-reverse-' + i), + labelText: me.textReverse + }).on('change', _.bind(function (checkbox, state) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putInvertCatOrder(state == 'checked'); + } + }, me)); - this.cmbHMajorType = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-h-major-type'), - cls : 'input-group-nr', - menuStyle : 'min-width: 140px;', - editable : false, - data : [ - {displayValue: this.textNone, value: Asc.c_oAscTickMark.TICK_MARK_NONE}, - {displayValue: this.textCross, value: Asc.c_oAscTickMark.TICK_MARK_CROSS}, - {displayValue: this.textIn, value: Asc.c_oAscTickMark.TICK_MARK_IN}, - {displayValue: this.textOut, value: Asc.c_oAscTickMark.TICK_MARK_OUT} - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.currentAxisProps) { - this.currentAxisProps.putMajorTickMark(record.value); - } - }, this)); + me.cmbHMajorType[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-h-major-type-' + i), + cls: 'input-group-nr', + menuStyle: 'min-width: 140px;', + editable: false, + data: [ + {displayValue: me.textNone, value: Asc.c_oAscTickMark.TICK_MARK_NONE}, + {displayValue: me.textCross, value: Asc.c_oAscTickMark.TICK_MARK_CROSS}, + {displayValue: me.textIn, value: Asc.c_oAscTickMark.TICK_MARK_IN}, + {displayValue: me.textOut, value: Asc.c_oAscTickMark.TICK_MARK_OUT} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putMajorTickMark(record.value); + } + }, me)); - this.cmbHMinorType = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-h-minor-type'), - cls : 'input-group-nr', - menuStyle : 'min-width: 140px;', - editable : false, - data : [ - {displayValue: this.textNone, value: Asc.c_oAscTickMark.TICK_MARK_NONE}, - {displayValue: this.textCross, value: Asc.c_oAscTickMark.TICK_MARK_CROSS}, - {displayValue: this.textIn, value: Asc.c_oAscTickMark.TICK_MARK_IN}, - {displayValue: this.textOut, value: Asc.c_oAscTickMark.TICK_MARK_OUT} - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.currentAxisProps) { - this.currentAxisProps.putMinorTickMark(record.value); - } - }, this)); + me.cmbHMinorType[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-h-minor-type-' + i), + cls: 'input-group-nr', + menuStyle: 'min-width: 140px;', + editable: false, + data: [ + {displayValue: me.textNone, value: Asc.c_oAscTickMark.TICK_MARK_NONE}, + {displayValue: me.textCross, value: Asc.c_oAscTickMark.TICK_MARK_CROSS}, + {displayValue: me.textIn, value: Asc.c_oAscTickMark.TICK_MARK_IN}, + {displayValue: me.textOut, value: Asc.c_oAscTickMark.TICK_MARK_OUT} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putMinorTickMark(record.value); + } + }, me)); - this.spnMarksInterval = new Common.UI.MetricSpinner({ - el : $('#chart-dlg-input-marks-interval'), - width : 140, - maxValue : 1000000, - minValue : 1, - step : 1, - defaultUnit : "", - value : '' - }).on('change', _.bind(function(field, newValue, oldValue) { - if (this.currentAxisProps) { - this.currentAxisProps.putIntervalBetweenTick(field.getNumberValue()); - } - }, this)); + me.spnMarksInterval[i] = new Common.UI.MetricSpinner({ + el: $('#chart-dlg-input-marks-interval-' + i), + width: 140, + maxValue: 1000000, + minValue: 1, + step: 1, + defaultUnit: "", + value: '' + }).on('change', _.bind(function (field, newValue, oldValue) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putIntervalBetweenTick(field.getNumberValue()); + } + }, me)); - this.cmbHLabelPos = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-h-label-pos'), - cls : 'input-group-nr', - menuStyle : 'min-width: 140px;', - editable : false, - data : [ - {displayValue: this.textNone, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE}, - {displayValue: this.textLow, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_LOW}, - {displayValue: this.textHigh, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_HIGH}, - {displayValue: this.textNextToAxis, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO} - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.currentAxisProps) { - this.currentAxisProps.putTickLabelsPos(record.value); - } - }, this)); + me.cmbHLabelPos[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-h-label-pos-' + i), + cls: 'input-group-nr', + menuStyle: 'min-width: 140px;', + editable: false, + data: [ + {displayValue: me.textNone, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE}, + {displayValue: me.textLow, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_LOW}, + {displayValue: me.textHigh, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_HIGH}, + {displayValue: me.textNextToAxis, value: Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putTickLabelsPos(record.value); + } + }, me)); - this.spnLabelDist = new Common.UI.MetricSpinner({ - el : $('#chart-dlg-input-label-dist'), - width : 140, - maxValue : 1000, - minValue : 0, - step : 1, - defaultUnit : "", - value : '' - }).on('change', _.bind(function(field, newValue, oldValue) { - if (this.currentAxisProps) { - this.currentAxisProps.putLabelsAxisDistance(field.getNumberValue()); - } - }, this)); + me.spnLabelDist[i] = new Common.UI.MetricSpinner({ + el: $('#chart-dlg-input-label-dist-' + i), + width: 140, + maxValue: 1000, + minValue: 0, + step: 1, + defaultUnit: "", + value: '' + }).on('change', _.bind(function (field, newValue, oldValue) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putLabelsAxisDistance(field.getNumberValue()); + } + }, me)); - this.spnLabelInterval = new Common.UI.MetricSpinner({ - el : $('#chart-dlg-input-label-int'), - width : 140, - maxValue : 1000000, - minValue : 1, - step : 1, - defaultUnit : "", - value : '' - }).on('change', _.bind(function(field, newValue, oldValue) { - this.cmbLabelInterval.suspendEvents(); - this.cmbLabelInterval.setValue(Asc.c_oAscBetweenLabelsRule.manual); - this.cmbLabelInterval.resumeEvents(); - if (this.currentAxisProps) { - this.currentAxisProps.putIntervalBetweenLabelsRule(Asc.c_oAscBetweenLabelsRule.manual); - this.currentAxisProps.putIntervalBetweenLabels(field.getNumberValue()); - } - }, this)); + me.spnLabelInterval[i] = new Common.UI.MetricSpinner({ + el: $('#chart-dlg-input-label-int-' + i), + width: 60, + maxValue: 1000000, + minValue: 1, + step: 1, + defaultUnit: "", + value: '' + }).on('change', _.bind(function (field, newValue, oldValue) { + me.cmbLabelInterval[i].suspendEvents(); + me.cmbLabelInterval[i].setValue(Asc.c_oAscBetweenLabelsRule.manual); + me.cmbLabelInterval[i].resumeEvents(); + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putIntervalBetweenLabelsRule(Asc.c_oAscBetweenLabelsRule.manual); + me.currentAxisProps[i].putIntervalBetweenLabels(field.getNumberValue()); + } + }, me)); - this.cmbLabelInterval = new Common.UI.ComboBox({ - el : $('#chart-dlg-combo-label-int'), - cls : 'input-group-nr', - menuStyle : 'min-width: 140px;', - editable : false, - data : [ - {displayValue: this.textAuto, value: Asc.c_oAscBetweenLabelsRule.auto}, - {displayValue: this.textManual, value: Asc.c_oAscBetweenLabelsRule.manual} - ], - takeFocusOnClose: true - }).on('selected', _.bind(function(combo, record) { - if (this.currentAxisProps) { - this.currentAxisProps.putIntervalBetweenLabelsRule(record.value); - if (record.value==Asc.c_oAscBetweenLabelsRule.auto) - this.spnLabelInterval.setValue(1, true); - } - }, this)); + me.cmbLabelInterval[i] = new Common.UI.ComboBox({ + el: $('#chart-dlg-combo-label-int-' + i), + cls: 'input-group-nr', + menuStyle: 'min-width: 100px;', + editable: false, + data: [ + {displayValue: me.textAuto, value: Asc.c_oAscBetweenLabelsRule.auto}, + {displayValue: me.textManual, value: Asc.c_oAscBetweenLabelsRule.manual} + ], + takeFocusOnClose: true + }).on('selected', _.bind(function (combo, record) { + if (me.currentAxisProps[i]) { + me.currentAxisProps[i].putIntervalBetweenLabelsRule(record.value); + if (record.value == Asc.c_oAscBetweenLabelsRule.auto) + me.spnLabelInterval[i].setValue(1, true); + } + }, me)); + + me.btnHFormat[i] = new Common.UI.Button({ + el: $('#chart-dlg-btn-h-format-' + i) + }).on('click', _.bind(me.openFormat, me, i)); + }; + addControlsH(0); + addControlsH(1); // Sparklines this.btnSparkType = new Common.UI.Button({ @@ -1002,12 +1016,19 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' getFocusedComponents: function() { return [ - this.cmbChartTitle, this.cmbLegendPos, this.cmbDataLabels, this.txtSeparator, this.cmbHorShow, this.cmbVertShow, - this.cmbHorTitle, this.cmbVertTitle, this.cmbHorGrid, this.cmbVertGrid, // 1 tab - this.cmbMinType , this.spnMinValue, this.cmbMaxType, this.spnMaxValue, this.cmbVCrossType, this.spnVAxisCrosses, - this.cmbUnits , this.cmbVMajorType, this.cmbVMinorType, this.cmbVLabelPos, // 2 tab - this.cmbHCrossType , this.spnHAxisCrosses, this.cmbAxisPos, this.cmbHMajorType, this.cmbHMinorType, this.spnMarksInterval, - this.cmbHLabelPos , this.spnLabelDist, this.cmbLabelInterval, this.spnLabelInterval, // 3 tab + this.cmbChartTitle, this.cmbLegendPos, this.cmbDataLabels, this.txtSeparator, // 1 tab + this.cmbVertTitle[0], this.cmbVertGrid[0], + this.cmbMinType[0], this.spnMinValue[0], this.cmbMaxType[0], this.spnMaxValue[0], this.cmbVCrossType[0], this.spnVAxisCrosses[0], + this.cmbUnits[0] , this.cmbVMajorType[0], this.cmbVMinorType[0], this.cmbVLabelPos[0], // 2 tab + this.cmbVertTitle[1], this.cmbVertGrid[1], + this.cmbMinType[1] , this.spnMinValue[1], this.cmbMaxType[1], this.spnMaxValue[1], this.cmbVCrossType[1], this.spnVAxisCrosses[1], + this.cmbUnits[1] , this.cmbVMajorType[1], this.cmbVMinorType[1], this.cmbVLabelPos[1], // 3 tab + this.cmbHorTitle[0], this.cmbHorGrid[0], + this.cmbHCrossType[0] , this.spnHAxisCrosses[0], this.cmbAxisPos[0], this.cmbHMajorType[0], this.cmbHMinorType[0], this.spnMarksInterval[0], + this.cmbHLabelPos[0] , this.spnLabelDist[0], this.cmbLabelInterval[0], this.spnLabelInterval[0], // 4 tab + this.cmbHorTitle[1], this.cmbHorGrid[1], + this.cmbHCrossType[1] , this.spnHAxisCrosses[1], this.cmbAxisPos[1], this.cmbHMajorType[1], this.cmbHMinorType[1], this.spnMarksInterval[1], + this.cmbHLabelPos[1] , this.spnLabelDist[1], this.cmbLabelInterval[1], this.spnLabelInterval[1], // 5 tab this.inputAltTitle, this.textareaAltDescription // 7 tab ]; }, @@ -1022,14 +1043,16 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' me.cmbChartTitle.focus(); break; case 2: - me.onVCategoryClick(btn); - me.cmbMinType.focus(); - break; case 3: - me.onHCategoryClick(btn); - me.cmbHCrossType.focus(); + me.onVCategoryClick(index-2); + me.cmbMinType[index-2].focus(); break; - case 7: + case 4: + case 5: + me.onHCategoryClick(index-4); + me.cmbHCrossType[index-4].focus(); + break; + case 9: me.inputAltTitle.focus(); break; } @@ -1043,22 +1066,24 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.btnsCategory[0].setVisible(this.isDiagramMode); // hide type for charts if (this.isChart) { - this.btnsCategory[4].setVisible(false); - this.btnsCategory[5].setVisible(false); + this.btnsCategory[6].setVisible(false); + this.btnsCategory[7].setVisible(false); } else { this.btnsCategory[1].setVisible(false); this.btnsCategory[2].setVisible(false); this.btnsCategory[3].setVisible(false); - this.btnsCategory[6].setVisible(false); - this.btnsCategory[7].setVisible(false); + this.btnsCategory[4].setVisible(false); + this.btnsCategory[5].setVisible(false); + this.btnsCategory[8].setVisible(false); + this.btnsCategory[9].setVisible(false); } if (this.storageName) { var value = Common.localStorage.getItem(this.storageName); this.setActiveCategory((value!==null) ? parseInt(value) : 0); value = this.getActiveCategory(); - if (value==2) this.onVCategoryClick(); - else if (value==3) this.onHCategoryClick(); + if (value==2 || value==3) this.onVCategoryClick(value-2); + else if (value==4 || value==5) this.onHCategoryClick(value-4); } }, @@ -1082,8 +1107,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.btnChartType.setIconCls('svgicon ' + 'chart-' + rawData.iconCls); this.chartSettings.changeType(rawData.type); this.updateAxisProps(rawData.type, true); - this.vertAxisProps = this.chartSettings.getVertAxisProps(); - this.horAxisProps = this.chartSettings.getHorAxisProps(); + this.vertAxisProps = this.chartSettings.getVertAxesProps(); + this.horAxisProps = this.chartSettings.getHorAxesProps(); this.updateDataLabels(rawData.type, this.cmbDataLabels.getValue()); this.currentChartType = rawData.type; }, @@ -1103,29 +1128,23 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' value = (type == Asc.c_oAscChartTypeSettings.pie || type == Asc.c_oAscChartTypeSettings.doughnut || type == Asc.c_oAscChartTypeSettings.pie3d); this.btnsCategory[2].setDisabled(value); this.btnsCategory[3].setDisabled(value); - this.cmbHorShow.setDisabled(value); - this.cmbVertShow.setDisabled(value); - this.cmbHorTitle.setDisabled(value); - this.cmbVertTitle.setDisabled(value); - this.cmbHorGrid.setDisabled(value); - this.cmbVertGrid.setDisabled(value); - - this.cmbHorShow.setValue(this.chartSettings.getShowHorAxis()); - this.cmbVertShow.setValue(this.chartSettings.getShowVerAxis()); - this.cmbHorTitle.setValue(this.chartSettings.getHorAxisLabel()); - this.cmbVertTitle.setValue(this.chartSettings.getVertAxisLabel()); - this.cmbHorGrid.setValue(this.chartSettings.getHorGridLines()); - this.cmbVertGrid.setValue(this.chartSettings.getVertGridLines()); + this.btnsCategory[4].setDisabled(value); + this.btnsCategory[5].setDisabled(value); + this.btnsCategory[2].setVisible(this.vertAxisProps.length>0); + this.btnsCategory[3].setVisible(this.vertAxisProps.length>1); + this.btnsCategory[4].setVisible(this.horAxisProps.length>0); + this.btnsCategory[5].setVisible(this.horAxisProps.length>1); value = (type == Asc.c_oAscChartTypeSettings.barNormal3d || type == Asc.c_oAscChartTypeSettings.barStacked3d || type == Asc.c_oAscChartTypeSettings.barStackedPer3d || type == Asc.c_oAscChartTypeSettings.hBarNormal3d || type == Asc.c_oAscChartTypeSettings.hBarStacked3d || type == Asc.c_oAscChartTypeSettings.hBarStackedPer3d || type == Asc.c_oAscChartTypeSettings.barNormal3dPerspective); - this.cmbAxisPos.setDisabled(value); + this.cmbAxisPos[0].setDisabled(value); + this.cmbAxisPos[1].setDisabled(value); value = (type == Asc.c_oAscChartTypeSettings.hBarNormal || type == Asc.c_oAscChartTypeSettings.hBarStacked || type == Asc.c_oAscChartTypeSettings.hBarStackedPer || type == Asc.c_oAscChartTypeSettings.hBarNormal3d || type == Asc.c_oAscChartTypeSettings.hBarStacked3d || type == Asc.c_oAscChartTypeSettings.hBarStackedPer3d); this.btnsCategory[2].options.contentTarget = (value) ? 'id-chart-settings-dlg-hor' : 'id-chart-settings-dlg-vert'; - this.btnsCategory[3].options.contentTarget = (value || type == Asc.c_oAscChartTypeSettings.scatter) ? 'id-chart-settings-dlg-vert' : 'id-chart-settings-dlg-hor'; + this.btnsCategory[4].options.contentTarget = (value || type == Asc.c_oAscChartTypeSettings.scatter) ? 'id-chart-settings-dlg-vert' : 'id-chart-settings-dlg-hor'; }, updateDataLabels: function(chartType, labelPos) { @@ -1166,100 +1185,112 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.onSelectDataLabels(this.cmbDataLabels, {value:labelPos}); }, - onVCategoryClick: function() { - (this.vertAxisProps.getAxisType()==Asc.c_oAscAxisType.val) ? this.fillVProps(this.vertAxisProps) : this.fillHProps(this.vertAxisProps); + onVCategoryClick: function(index) { + (this.vertAxisProps[index].getAxisType()==Asc.c_oAscAxisType.val) ? this.fillVProps(this.vertAxisProps[index], index) : this.fillHProps(this.vertAxisProps[index], index); }, - onHCategoryClick: function() { - (this.horAxisProps.getAxisType()==Asc.c_oAscAxisType.val) ? this.fillVProps(this.horAxisProps) : this.fillHProps(this.horAxisProps); + onHCategoryClick: function(index) { + (this.horAxisProps[index].getAxisType()==Asc.c_oAscAxisType.val) ? this.fillVProps(this.horAxisProps[index], index) : this.fillHProps(this.horAxisProps[index], index); }, - fillVProps: function(props) { + fillVProps: function(props, index) { if (props.getAxisType() !== Asc.c_oAscAxisType.val) return; - if (this._originalAxisVValues==undefined) { - this._originalAxisVValues = { + if (this._originalAxisVValues==undefined) + this._originalAxisVValues = []; + if (this._originalAxisVValues[index]==undefined) { + this._originalAxisVValues[index] = { minAuto: (props.getMinVal()==null) ? 0 : props.getMinVal(), maxAuto: (props.getMaxVal()==null) ? 10 : props.getMaxVal(), crossesAuto: (props.getCrosses()==null) ? 0 : props.getCrosses() }; } - this.cmbMinType.setValue(props.getMinValRule()); - var value = (props.getMinValRule()==Asc.c_oAscValAxisRule.auto) ? this._originalAxisVValues.minAuto : props.getMinVal(); - this.spnMinValue.setValue((value==null) ? '' : value, true); + this.chVertHide[index].setValue(!props.getShow()); + this.cmbVertGrid[index].setValue(props.getGridlines()); + this.cmbVertTitle[index].setValue(props.getLabel()); - this.cmbMaxType.setValue(props.getMaxValRule()); - value = (props.getMaxValRule()==Asc.c_oAscValAxisRule.auto) ? this._originalAxisVValues.maxAuto : props.getMaxVal(); - this.spnMaxValue.setValue((value==null) ? '' : value, true); + this.cmbMinType[index].setValue(props.getMinValRule()); + var value = (props.getMinValRule()==Asc.c_oAscValAxisRule.auto) ? this._originalAxisVValues[index].minAuto : props.getMinVal(); + this.spnMinValue[index].setValue((value==null) ? '' : value, true); + + this.cmbMaxType[index].setValue(props.getMaxValRule()); + value = (props.getMaxValRule()==Asc.c_oAscValAxisRule.auto) ? this._originalAxisVValues[index].maxAuto : props.getMaxVal(); + this.spnMaxValue[index].setValue((value==null) ? '' : value, true); value = props.getCrossesRule(); - this.cmbVCrossType.setValue(value); + this.cmbVCrossType[index].setValue(value); switch (value) { case Asc.c_oAscCrossesRule.minValue: - value = this.spnMinValue.getNumberValue(); + value = this.spnMinValue[index].getNumberValue(); break; case Asc.c_oAscCrossesRule.maxValue: - value = this.spnMaxValue.getNumberValue(); + value = this.spnMaxValue[index].getNumberValue(); break; case Asc.c_oAscCrossesRule.auto: - value = this._originalAxisVValues.crossesAuto; + value = this._originalAxisVValues[index].crossesAuto; break; default: value = props.getCrosses(); break; } - this.spnVAxisCrosses.setValue((value==null) ? '' : value, true); + this.spnVAxisCrosses[index].setValue((value==null) ? '' : value, true); - this.cmbUnits.setValue(props.getDispUnitsRule()); - this.chVReverse.setValue(props.getInvertValOrder(), true); - this.cmbVMajorType.setValue(props.getMajorTickMark()); - this.cmbVMinorType.setValue(props.getMinorTickMark()); - this.cmbVLabelPos.setValue(props.getTickLabelsPos()); + this.cmbUnits[index].setValue(props.getDispUnitsRule()); + this.chVReverse[index].setValue(props.getInvertValOrder(), true); + this.cmbVMajorType[index].setValue(props.getMajorTickMark()); + this.cmbVMinorType[index].setValue(props.getMinorTickMark()); + this.cmbVLabelPos[index].setValue(props.getTickLabelsPos()); - this.currentAxisProps = props; + this.currentAxisProps[index] = props; }, - fillHProps: function(props) { + fillHProps: function(props, index) { if (props.getAxisType() !== Asc.c_oAscAxisType.cat) return; - if (this._originalAxisHValues==undefined) { - this._originalAxisHValues = { + if (this._originalAxisHValues==undefined) + this._originalAxisHValues = []; + if (this._originalAxisHValues[index]==undefined) { + this._originalAxisHValues[index] = { minAuto: (props.getCrossMinVal()==null) ? 0 : props.getCrossMinVal(), maxAuto: (props.getCrossMaxVal()==null) ? 10 : props.getCrossMaxVal(), crossesAuto: (props.getCrosses()==null) ? 0 : props.getCrosses() }; } + this.chHorHide[index].setValue(!props.getShow()); + this.cmbHorGrid[index].setValue(props.getGridlines()); + this.cmbHorTitle[index].setValue(props.getLabel()); + var value = props.getCrossesRule(); - this.cmbHCrossType.setValue(value); + this.cmbHCrossType[index].setValue(value); switch (value) { case Asc.c_oAscCrossesRule.minValue: - value = this._originalAxisHValues.minAuto; + value = this._originalAxisHValues[index].minAuto; break; case Asc.c_oAscCrossesRule.maxValue: - value = this._originalAxisHValues.maxAuto; + value = this._originalAxisHValues[index].maxAuto; break; case Asc.c_oAscCrossesRule.auto: - value = this._originalAxisHValues.crossesAuto; + value = this._originalAxisHValues[index].crossesAuto; break; default: value = props.getCrosses(); break; } - this.spnHAxisCrosses.setValue((value==null) ? '' : value, true); + this.spnHAxisCrosses[index].setValue((value==null) ? '' : value, true); - this.cmbAxisPos.setValue(props.getLabelsPosition()); - this.chHReverse.setValue(props.getInvertCatOrder(), true); - this.cmbHMajorType.setValue(props.getMajorTickMark()); - this.cmbHMinorType.setValue(props.getMinorTickMark()); - this.spnMarksInterval.setValue(props.getIntervalBetweenTick(), true); - this.cmbHLabelPos.setValue(props.getTickLabelsPos()); - this.spnLabelDist.setValue(props.getLabelsAxisDistance(), true); + this.cmbAxisPos[index].setValue(props.getLabelsPosition()); + this.chHReverse[index].setValue(props.getInvertCatOrder(), true); + this.cmbHMajorType[index].setValue(props.getMajorTickMark()); + this.cmbHMinorType[index].setValue(props.getMinorTickMark()); + this.spnMarksInterval[index].setValue(props.getIntervalBetweenTick(), true); + this.cmbHLabelPos[index].setValue(props.getTickLabelsPos()); + this.spnLabelDist[index].setValue(props.getLabelsAxisDistance(), true); value = props.getIntervalBetweenLabelsRule(); - this.cmbLabelInterval.setValue(value); - this.spnLabelInterval.setValue((value===Asc.c_oAscBetweenLabelsRule.manual) ? props.getIntervalBetweenLabels(): 1, true); + this.cmbLabelInterval[index].setValue(value); + this.spnLabelInterval[index].setValue((value===Asc.c_oAscBetweenLabelsRule.manual) ? props.getIntervalBetweenLabels(): 1, true); - this.currentAxisProps = props; + this.currentAxisProps[index] = props; }, updateSparkStyles: function(styles) { @@ -1357,25 +1388,6 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this._noApply = false; - // var value = props.getRange(); - // this.txtDataRange.setValue((value) ? value : ''); - // this.dataRangeValid = value; - // - // this.txtDataRange.validation = function(value) { - // if (_.isEmpty(value)) { - // if (!me.cmbDataDirect.isDisabled()) me.cmbDataDirect.setDisabled(true); - // return true; - // } - // - // if (me.cmbDataDirect.isDisabled()) me.cmbDataDirect.setDisabled(false); - // - // var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false); - // return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; - // }; - // - // this.cmbDataDirect.setDisabled(value===null); - // this.cmbDataDirect.setValue(props.getInColumns() ? 1 : 0); - this.cmbChartTitle.setValue(props.getTitle()); this.cmbLegendPos.setValue(props.getLegendPos()); @@ -1389,10 +1401,10 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.txtSeparator.setValue((value) ? value : ''); // Vertical Axis - this.vertAxisProps = props.getVertAxisProps(); + this.vertAxisProps = props.getVertAxesProps(); // Horizontal Axis - this.horAxisProps = props.getHorAxisProps(); + this.horAxisProps = props.getHorAxesProps(); this.updateAxisProps(this._state.ChartType); this.currentChartType = this._state.ChartType; @@ -1496,15 +1508,6 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.chartSettings.putTitle(this.cmbChartTitle.getValue()); this.chartSettings.putLegendPos(this.cmbLegendPos.getValue()); - this.chartSettings.putShowHorAxis(this.cmbHorShow.getValue()); - this.chartSettings.putShowVerAxis(this.cmbVertShow.getValue()); - - this.chartSettings.putHorAxisLabel(this.cmbHorTitle.getValue()); - this.chartSettings.putVertAxisLabel(this.cmbVertTitle.getValue()); - - this.chartSettings.putHorGridLines(this.cmbHorGrid.getValue()); - this.chartSettings.putVertGridLines(this.cmbVertGrid.getValue()); - this.chartSettings.putDataLabelsPos(this.cmbDataLabels.getValue()); this.chartSettings.putShowSerName(this.chSeriesName.getValue()=='checked'); @@ -1524,8 +1527,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.chartSettings.putSmooth(value==2); } - this.chartSettings.putVertAxisProps(this.vertAxisProps); - this.chartSettings.putHorAxisProps(this.horAxisProps); + // this.chartSettings.putVertAxisProps(this.vertAxisProps); + // this.chartSettings.putHorAxisProps(this.horAxisProps); if ((this.isAltTitleChanged || this.isAltDescChanged) && !this._changedImageProps) this._changedImageProps = new Asc.asc_CImgProperty(); @@ -1650,7 +1653,6 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' } }, - onSelectLocationData: function() { var me = this; if (me.api) { @@ -1679,6 +1681,35 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' } }, + openFormat: function(index) { + var me = this, + props = me.currentAxisProps[index], + fmt = props.getNumFmt(), + value = me.api.asc_getLocale(), + lang = Common.Utils.InternalSettings.get("sse-config-lang"); + (!value) && (value = (lang ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(lang)) : 0x0409)); + + var win = (new SSE.Views.FormatSettingsDialog({ + api: me.api, + handler: function(result, settings) { + if (result=='ok' && settings) { + fmt.putSourceLinked(settings.linked); + fmt.putFormatCode(settings.format); + me.chartSettings.endEditData(); + me._isEditFormat = false; + } + }, + linked: true, + props : {format: fmt.getFormatCode(), formatInfo: fmt.getFormatCellsInfo(), langId: value, chartFormat: fmt} + })).on('close', function() { + me._isEditFormat && me.chartSettings.cancelEditData(); + me._isEditFormat = false; + }); + me._isEditFormat = true; + me.chartSettings.startEditData(); + win.show(); + }, + show: function() { Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments); @@ -1703,20 +1734,14 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' textLegendTop: 'Top', textLegendRight: 'Right', textLegendLeft: 'Left', - textShowAxis: 'Display Axis', - textShowGrid: 'Grid Lines', - textDataRange: 'Data Range', textChartTitle: 'Chart Title', textXAxisTitle: 'X Axis Title', textYAxisTitle: 'Y Axis Title', txtEmpty: 'This field is required', textInvalidRange: 'ERROR! Invalid cells range', - textTypeStyle: 'Chart Type, Style & Data Range', textChartElementsLegend: 'Chart Elements & Chart Legend', textLayout: 'Layout', textLegendPos: 'Legend', - textHorTitle: 'Horizontal Axis Title', - textVertTitle: 'Vertical Axis Title', textDataLabels: 'Data Labels', textSeparator: 'Data Labels Separator', textSeriesName: 'Series Name', @@ -1771,8 +1796,6 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' textManual: 'Manual', textBetweenTickMarks: 'Between Tick Marks', textOnTickMarks: 'On Tick Marks', - textHorGrid: 'Horizontal Gridlines', - textVertGrid: 'Vertical Gridlines', textLines: 'Lines', textMarkers: 'Markers', textMajor: 'Major', @@ -1784,7 +1807,6 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' textTypeData: 'Type & Data', textStyle: 'Style', textSelectData: 'Select data', - textDataSeries: 'Data series', 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.', textAxisSettings: 'Axis Settings', @@ -1819,7 +1841,12 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' textSnap: 'Cell Snapping', textAbsolute: 'Don\'t move or size with cells', textOneCell: 'Move but don\'t size with cells', - textTwoCell: 'Move and size with cells' + textTwoCell: 'Move and size with cells', + textVertAxisSec: 'Secondary Vertical Axis', + textHorAxisSec: 'Secondary Horizontal Axis', + textAxisTitle: 'Title', + textHideAxis: 'Hide axis', + textFormat: 'Label format' }, SSE.Views.ChartSettingsDlg || {})); }); diff --git a/apps/spreadsheeteditor/main/app/view/ChartTypeDialog.js b/apps/spreadsheeteditor/main/app/view/ChartTypeDialog.js new file mode 100644 index 000000000..043889d85 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/view/ChartTypeDialog.js @@ -0,0 +1,449 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2020 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +/** + * ChartTypeDialog.js + * + * Created by Julia Radzhabova on 03.12.2020 + * Copyright (c) 2020 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'common/main/lib/util/utils', + 'common/main/lib/component/ComboBox', + 'common/main/lib/component/ListView', + 'common/main/lib/view/AdvancedSettingsWindow' +], function () { 'use strict'; + + var _CustomItem = Common.UI.DataViewItem.extend({ + initialize : function(options) { + Common.UI.BaseView.prototype.initialize.call(this, options); + + var me = this; + + me.template = me.options.template || me.template; + + me.listenTo(me.model, 'change:sort', function() { + me.render(); + me.trigger('change', me, me.model); + }); + me.listenTo(me.model, 'change:selected', function() { + var el = me.$el || $(me.el); + el.toggleClass('selected', me.model.get('selected') && me.model.get('allowSelected')); + me.onSelectChange(me.model, me.model.get('selected') && me.model.get('allowSelected')); + }); + me.listenTo(me.model, 'remove', me.remove); + } + }); + + SSE.Views.ChartTypeDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + options: { + contentWidth: 370, + height: 385 + }, + + initialize : function(options) { + var me = this; + + _.extend(this.options, { + title: this.textTitle, + template: [ + ' ',
+ ' '
+ ].join('')
+ }, options);
+
+ this.handler = options.handler;
+
+ Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
+
+ this._changedProps = null;
+
+ this.api = this.options.api;
+ this.chartSettings = this.options.chartSettings;
+ this.currentChartType = Asc.c_oAscChartTypeSettings.barNormal;
+ },
+
+ render: function() {
+ Common.Views.AdvancedSettingsWindow.prototype.render.call(this);
+ var me = this;
+
+ var arr = Common.define.chartData.getChartGroupData();
+ this._arrSeriesGroups = [];
+ arr.forEach(function(item) {
+ (item.id !== 'menu-chart-group-combo') && (item.id !== 'menu-chart-group-stock') && me._arrSeriesGroups.push(item);
+ });
+ arr = Common.define.chartData.getChartData();
+ this._arrSeriesType = [];
+ arr.forEach(function(item) {
+ !item.is3d && item.type!==Asc.c_oAscChartTypeSettings.stock &&
+ item.type!==Asc.c_oAscChartTypeSettings.comboBarLine && item.type!==Asc.c_oAscChartTypeSettings.comboBarLineSecondary &&
+ item.type!==Asc.c_oAscChartTypeSettings.comboAreaBar && item.type!==Asc.c_oAscChartTypeSettings.comboCustom && me._arrSeriesType.push(item);
+ });
+
+ this.btnChartType = new Common.UI.Button({
+ cls : 'btn-large-dataview',
+ iconCls : 'svgicon chart-bar-normal',
+ menu : new Common.UI.Menu({
+ style: 'width: 364px; padding-top: 12px;',
+ additionalAlign: this.menuAddAlign,
+ items: [
+ { template: _.template('') }
+ ]
+ })
+ });
+ this.btnChartType.on('render:after', function(btn) {
+ me.mnuChartTypePicker = new Common.UI.DataView({
+ el: $('#chart-type-dlg-menu-type', me.$window),
+ parentMenu: btn.menu,
+ restoreHeight: 421,
+ groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()),
+ store: new Common.UI.DataViewStore(arr),
+ itemTemplate: _.template('')
+ });
+ });
+ this.btnChartType.render($('#chart-type-dlg-button-type'), this.$window);
+ this.mnuChartTypePicker.on('item:click', _.bind(this.onSelectType, this));
+
+ this.stylesList = new Common.UI.DataView({
+ el: $('#chart-type-dlg-styles-list', this.$window),
+ store: new Common.UI.DataViewStore(),
+ cls: 'bordered',
+ enableKeyEvents: this.options.enableKeyEvents,
+ itemTemplate : _.template([
+ '',
+ ' ',
+ '',
+ '
',
+ ' '
+ ].join(''))
+ });
+ this.stylesList.on('item:select', _.bind(this.onSelectStyles, this));
+
+ this.seriesList = new Common.UI.ListView({
+ el: $('#chart-type-dlg-series-list', this.$window),
+ store: new Common.UI.DataViewStore(),
+ emptyText: '',
+ enableKeyEvents: false,
+ scrollAlwaysVisible: true,
+ template: _.template([''].join('')),
+ itemTemplate: _.template([
+ '',
+ '',
+ ' '
+ ].join(''))
+ });
+ this.seriesList.createNewItem = function(record) {
+ return new _CustomItem({
+ template: this.itemTemplate,
+ model: record
+ });
+ };
+ this.NotCombinedSettings = $('.simple-chart', this.$window);
+ this.CombinedSettings = $('.combined-chart', this.$window);
+
+ this.afterRender();
+ },
+
+ afterRender: function() {
+ this._setDefaults(this.chartSettings);
+ },
+
+ show: function() {
+ Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments);
+ },
+
+ close: function () {
+ this.api.asc_onCloseChartFrame();
+ Common.Views.AdvancedSettingsWindow.prototype.close.apply(this, arguments);
+ },
+
+ _setDefaults: function (props) {
+ var me = this;
+ if (props ){
+ this.chartSettings = props;
+ this.currentChartType = props.getType();
+ var record = this.mnuChartTypePicker.store.findWhere({type: this.currentChartType});
+ this.mnuChartTypePicker.selectRecord(record, true);
+ if (record) {
+ this.btnChartType.setIconCls('svgicon ' + 'chart-' + record.get('iconCls'));
+ } else
+ this.btnChartType.setIconCls('svgicon');
+ this.seriesList.on('item:add', _.bind(this.addControls, this));
+ this.seriesList.on('item:change', _.bind(this.addControls, this));
+ 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
+ this.updateChartStyles(this.api.asc_getChartPreviews(this.currentChartType));
+ }
+ },
+
+ getSettings: function () {
+ return { chartSettings: this.chartSettings};
+ },
+
+ onDlgBtnClick: function(event) {
+ var state = (typeof(event) == 'object') ? event.currentTarget.attributes['result'].value : event;
+ if (state == 'ok') {
+ // if (!this.isRangeValid()) return;
+ this.handler && this.handler.call(this, state, (state == 'ok') ? this.getSettings() : undefined);
+ }
+
+ this.close();
+ },
+
+ onPrimary: function() {
+ this.onDlgBtnClick('ok');
+ return false;
+ },
+
+ onSelectType: function(picker, itemView, record) {
+ var rawData = {},
+ isPickerSelect = _.isFunction(record.toJSON);
+
+ if (isPickerSelect){
+ if (record.get('selected')) {
+ rawData = record.toJSON();
+ } else {
+ // record deselected
+ return;
+ }
+ } 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;
+ if (isCombo && this.chartSettings.getSeries().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 (isCombo)
+ this.updateSeriesList(this.chartSettings.getSeries());
+ else
+ this.updateChartStyles(this.api.asc_getChartPreviews(this.currentChartType));
+ },
+
+ updateChartStyles: function(styles) {
+ var me = this;
+ if (styles && styles.length>0){
+ var stylesStore = this.stylesList.store;
+ if (stylesStore) {
+ var count = stylesStore.length;
+ if (count>0 && count==styles.length) {
+ var data = stylesStore.models;
+ _.each(styles, function(style, index){
+ data[index].set('imageUrl', style.asc_getImage());
+ });
+ } else {
+ var stylearray = [],
+ selectedIdx = -1;
+ _.each(styles, function(item, index){
+ stylearray.push({
+ imageUrl: item.asc_getImage(),
+ data : item.asc_getName(),
+ tip : me.textStyle + ' ' + item.asc_getName()
+ });
+ });
+ stylesStore.reset(stylearray, {silent: false});
+ }
+ }
+ } else {
+ this.stylesList.store.reset();
+ }
+ this.stylesList.setDisabled(!styles || styles.length<1);
+ },
+
+ onSelectStyles: function(dataView, itemView, record) {
+ this.chartSettings.putStyle(record.get('data'));
+ },
+
+ updateSeriesList: function(series, index) {
+ var arr = [];
+ var store = this.seriesList.store;
+ for (var i = 0, len = series.length; i < len; i++)
+ {
+ var item = series[i],
+ rec = new Common.UI.DataViewModel();
+ rec.set({
+ value: item.asc_getSeriesName(),
+ type: item.asc_getChartType(),
+ isSecondary: item.asc_getIsSecondaryAxis(),
+ canChangeSecondary: item.asc_canChangeAxisType(),
+ seriesIndex: i,
+ series: item
+ });
+ arr.push(rec);
+ }
+ store.reset(arr);
+ (arr.length>0) && (index!==undefined) && (index < arr.length) && this.seriesList.selectByIndex(index);
+ },
+
+ addControls: function(listView, itemView, item) {
+ if (!item) return;
+
+ var me = this,
+ i = item.get('seriesIndex'),
+ cmpEl = this.seriesList.cmpEl.find('#chart-type-dlg-item-' + i),
+ series = item.get('series');
+ series.asc_drawPreviewRect('chart-type-dlg-series-preview-' + i);
+ var combo = this.initSeriesType('#chart-type-dlg-cmb-series-' + i, i, item);
+ var check = new Common.UI.CheckBox({
+ el: cmpEl.find('#chart-type-dlg-chk-series-' + i),
+ value: item.get('isSecondary'),
+ disabled: !item.get('canChangeSecondary')
+ });
+ check.on('change', function(field, newValue, oldValue, eOpts) {
+ var res = series.asc_TryChangeAxisType(field.getValue()=='checked');
+ if (res !== Asc.c_oAscError.ID.No) {
+ field.setValue(field.getValue()!='checked', true);
+ } else
+ me.updateSeriesList(me.chartSettings.getSeries(), i);
+ });
+ cmpEl.on('mousedown', '.combobox', function(){
+ me.seriesList.selectRecord(item);
+ });
+ },
+
+ initSeriesType: function(id, index, item) {
+ var me = this,
+ series = item.get('series'),
+ store = new Common.UI.DataViewStore(me._arrSeriesType),
+ currentTypeRec = store.findWhere({type: item.get('type')}),
+ tip = currentTypeRec ? currentTypeRec.get('tip') : '',
+ el = $(id);
+ var combo = new Common.UI.ComboBox({
+ el: el,
+ template: _.template([
+ ' '
+ ].join(''))
+ });
+ var combomenu = new Common.UI.Menu({
+ cls: 'menu-absolute',
+ style: 'width: 318px; padding-top: 12px;',
+ additionalAlign: this.menuAddAlign,
+ items: [
+ { template: _.template('') }
+ ]
+ });
+ combomenu.render(el);
+ combo.setValue(tip);
+ var onShowBefore = function(menu) {
+ var picker = new Common.UI.DataView({
+ el: $('#chart-type-dlg-series-menu-' + index),
+ parentMenu: menu,
+ restoreHeight: 421,
+ groups: new Common.UI.DataViewGroupStore(me._arrSeriesGroups),
+ store: store,
+ itemTemplate: _.template('')
+ });
+ picker.selectRecord(currentTypeRec, true);
+ picker.on('item:click', function(picker, view, record){
+ var oldtype = item.get('type');
+ var res = series.asc_TryChangeChartType(record.get('type'));
+ if (res == Asc.c_oAscError.ID.No) {
+ combo.setValue(record.get('tip'));
+ me.updateSeriesList(me.chartSettings.getSeries(), index);
+ } else {
+ var oldrecord = picker.store.findWhere({type: oldtype});
+ picker.selectRecord(oldrecord, true);
+ if (res==Asc.c_oAscError.ID.SecondaryAxis)
+ Common.UI.warning({msg: me.errorSecondaryAxis, maxwidth: 500}); }
+ });
+ menu.off('show:before', onShowBefore);
+ };
+ combomenu.on('show:before', onShowBefore);
+ return combo;
+ },
+
+ ShowHideSettings: function(type) {
+ var isCombo = type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
+ type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom;
+ this.NotCombinedSettings.toggleClass('hidden', isCombo);
+ this.CombinedSettings.toggleClass('hidden', !isCombo);
+ },
+
+ textTitle: 'Chart Type',
+ textType: 'Type',
+ 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.',
+ errorComboSeries: 'To create a combination chart, select at least two series of data.'
+
+ }, SSE.Views.ChartTypeDialog || {}))
+});
diff --git a/apps/spreadsheeteditor/main/app/view/FormatSettingsDialog.js b/apps/spreadsheeteditor/main/app/view/FormatSettingsDialog.js
index 169b2bb0c..f2690df99 100644
--- a/apps/spreadsheeteditor/main/app/view/FormatSettingsDialog.js
+++ b/apps/spreadsheeteditor/main/app/view/FormatSettingsDialog.js
@@ -84,10 +84,17 @@ define([
me.CurrencySymbolsData = null;
me.langId = 0x0409;
+ this.api = options.api;
+ this.handler = options.handler;
+ this.props = options.props;
+ this.linked = options.linked || false;
+
+ var height = this.linked ? 360 : 340;
_.extend(this.options, {
title: this.textTitle,
+ height: height,
template: [
- ' ',
+ '',
+ ' ',
+ ' ',
+ ' ',
' ',
' ',
'',
'
Are you sure you want to continue?", "SSE.Controllers.Toolbar.warnMergeLostData": "Only the data from the upper-left cell will remain in the merged cell. Are you sure you want to continue?", + "SSE.Controllers.Toolbar.errorComboSeries": "To create a combination chart, select at least two series of data.", "SSE.Controllers.Viewport.textFreezePanes": "Freeze Panes", "SSE.Controllers.Viewport.textFreezePanesShadow:": "Show Frozen Panes Shadow", "SSE.Controllers.Viewport.textHideFBar": "Hide Formula Bar", @@ -1382,6 +1383,7 @@ "SSE.Views.ChartSettings.textStyle": "Style", "SSE.Views.ChartSettings.textType": "Type", "SSE.Views.ChartSettings.textWidth": "Width", + "SSE.Views.ChartSettings.textChangeType": "Change type", "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: opening price, max price, min price, closing price.", @@ -1407,9 +1409,9 @@ "SSE.Views.ChartSettingsDlg.textCustom": "Custom", "SSE.Views.ChartSettingsDlg.textDataColumns": "in columns", "SSE.Views.ChartSettingsDlg.textDataLabels": "Data Labels", - "SSE.Views.ChartSettingsDlg.textDataRange": "Data Range", + "del_SSE.Views.ChartSettingsDlg.textDataRange": "Data Range", "SSE.Views.ChartSettingsDlg.textDataRows": "in rows", - "SSE.Views.ChartSettingsDlg.textDataSeries": "Data series", + "del_SSE.Views.ChartSettingsDlg.textDataSeries": "Data series", "SSE.Views.ChartSettingsDlg.textDisplayLegend": "Display Legend", "SSE.Views.ChartSettingsDlg.textEmptyCells": "Hidden and Empty cells", "SSE.Views.ChartSettingsDlg.textEmptyLine": "Connect data points with line", @@ -1421,9 +1423,9 @@ "SSE.Views.ChartSettingsDlg.textHide": "Hide", "SSE.Views.ChartSettingsDlg.textHigh": "High", "SSE.Views.ChartSettingsDlg.textHorAxis": "Horizontal Axis", - "SSE.Views.ChartSettingsDlg.textHorGrid": "Horizontal Gridlines", + "del_SSE.Views.ChartSettingsDlg.textHorGrid": "Horizontal Gridlines", "SSE.Views.ChartSettingsDlg.textHorizontal": "Horizontal", - "SSE.Views.ChartSettingsDlg.textHorTitle": "Horizontal Axis Title", + "del_SSE.Views.ChartSettingsDlg.textHorTitle": "Horizontal Axis Title", "SSE.Views.ChartSettingsDlg.textHundredMil": "100 000 000", "SSE.Views.ChartSettingsDlg.textHundreds": "Hundreds", "SSE.Views.ChartSettingsDlg.textHundredThousands": "100 000", @@ -1475,11 +1477,11 @@ "SSE.Views.ChartSettingsDlg.textSeparator": "Data Labels Separator", "SSE.Views.ChartSettingsDlg.textSeriesName": "Series Name", "SSE.Views.ChartSettingsDlg.textShow": "Show", - "SSE.Views.ChartSettingsDlg.textShowAxis": "Display Axis", + "del_SSE.Views.ChartSettingsDlg.textShowAxis": "Display Axis", "SSE.Views.ChartSettingsDlg.textShowBorders": "Display chart borders", "SSE.Views.ChartSettingsDlg.textShowData": "Show data in hidden rows and columns", "SSE.Views.ChartSettingsDlg.textShowEmptyCells": "Show empty cells as", - "SSE.Views.ChartSettingsDlg.textShowGrid": "Grid Lines", + "del_SSE.Views.ChartSettingsDlg.textShowGrid": "Grid Lines", "SSE.Views.ChartSettingsDlg.textShowSparkAxis": "Show Axis", "SSE.Views.ChartSettingsDlg.textShowValues": "Display chart values", "SSE.Views.ChartSettingsDlg.textSingle": "Single Sparkline", @@ -1499,16 +1501,28 @@ "SSE.Views.ChartSettingsDlg.textTwoCell": "Move and size with cells", "SSE.Views.ChartSettingsDlg.textType": "Type", "SSE.Views.ChartSettingsDlg.textTypeData": "Type & Data", - "SSE.Views.ChartSettingsDlg.textTypeStyle": "Chart Type, Style & Data Range", + "del_SSE.Views.ChartSettingsDlg.textTypeStyle": "Chart Type, Style & Data Range", "SSE.Views.ChartSettingsDlg.textUnits": "Display Units", "SSE.Views.ChartSettingsDlg.textValue": "Value", "SSE.Views.ChartSettingsDlg.textVertAxis": "Vertical Axis", - "SSE.Views.ChartSettingsDlg.textVertGrid": "Vertical Gridlines", - "SSE.Views.ChartSettingsDlg.textVertTitle": "Vertical Axis Title", + "del_SSE.Views.ChartSettingsDlg.textVertGrid": "Vertical Gridlines", + "del_SSE.Views.ChartSettingsDlg.textVertTitle": "Vertical Axis Title", "SSE.Views.ChartSettingsDlg.textXAxisTitle": "X Axis Title", "SSE.Views.ChartSettingsDlg.textYAxisTitle": "Y Axis Title", "SSE.Views.ChartSettingsDlg.textZero": "Zero", "SSE.Views.ChartSettingsDlg.txtEmpty": "This field is required", + "SSE.Views.ChartSettingsDlg.textVertAxisSec": "Secondary Vertical Axis", + "SSE.Views.ChartSettingsDlg.textHorAxisSec": "Secondary Horizontal Axis", + "SSE.Views.ChartSettingsDlg.textAxisTitle": "Title", + "SSE.Views.ChartSettingsDlg.textHideAxis": "Hide axis", + "SSE.Views.ChartSettingsDlg.textFormat": "Label format", + "SSE.Views.ChartTypeDialog.textTitle": "Chart Type", + "SSE.Views.ChartTypeDialog.textType": "Type", + "SSE.Views.ChartTypeDialog.textStyle": "Style", + "SSE.Views.ChartTypeDialog.textSeries": "Series", + "SSE.Views.ChartTypeDialog.textSecondary": "Secondary Axis", + "SSE.Views.ChartTypeDialog.errorSecondaryAxis": "The selected chart type requires the secondary axis that an existing chart is using. Select another chart type.", + "SSE.Views.ChartTypeDialog.errorComboSeries": "To create a combination chart, select at least two series of data.", "SSE.Views.CreatePivotDialog.textDataRange": "Source data range", "SSE.Views.CreatePivotDialog.textDestination": "Choose where to place the table", "SSE.Views.CreatePivotDialog.textExist": "Existing worksheet", @@ -1919,6 +1933,7 @@ "SSE.Views.FormatSettingsDialog.txtUpto1": "Up to one digit (1/3)", "SSE.Views.FormatSettingsDialog.txtUpto2": "Up to two digits (12/25)", "SSE.Views.FormatSettingsDialog.txtUpto3": "Up to three digits (131/135)", + "SSE.Views.FormatSettingsDialog.textLinked": "Linked to source", "SSE.Views.FormulaDialog.sDescription": "Description", "SSE.Views.FormulaDialog.textGroupDescription": "Select Function Group", "SSE.Views.FormulaDialog.textListDescription": "Select Function", @@ -2861,6 +2876,7 @@ "SSE.Views.Toolbar.tipDigStylePercent": "Percent style", "SSE.Views.Toolbar.tipEditChart": "Edit Chart", "SSE.Views.Toolbar.tipEditChartData": "Select Data", + "SSE.Views.Toolbar.tipEditChartType": "Change Chart Type", "SSE.Views.Toolbar.tipEditHeader": "Edit header or footer", "SSE.Views.Toolbar.tipFontColor": "Font color", "SSE.Views.Toolbar.tipFontName": "Font", |