/* * * (c) Copyright Ascensio System SIA 2010-2019 * * 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 * */ /** * ChartSettingsDlg.js * * Created by Julia Radzhabova on 4/04/14 * Copyright (c) 2018 Ascensio System SIA. All rights reserved. * */ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template', 'common/main/lib/view/AdvancedSettingsWindow', 'common/main/lib/component/ListView', 'common/main/lib/component/CheckBox', 'common/main/lib/component/InputField', 'spreadsheeteditor/main/app/view/CellRangeDialog', 'spreadsheeteditor/main/app/view/ChartDataRangeDialog' ], function (contentTemplate) { '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.ChartSettingsDlg = Common.Views.AdvancedSettingsWindow.extend(_.extend({ options: { contentWidth: 322, height: 535, toggleGroup: 'chart-settings-dlg-group', storageName: 'sse-chart-settings-adv-category' }, initialize : function(options) { _.extend(this.options, { title: this.textTitle, items: [ {panelId: 'id-chart-settings-dlg-style', panelCaption: this.textType}, {panelId: 'id-chart-settings-dlg-data', panelCaption: this.textData}, {panelId: 'id-chart-settings-dlg-layout', panelCaption: this.textLayout}, {panelId: 'id-chart-settings-dlg-vert', panelCaption: this.textVertAxis}, {panelId: 'id-chart-settings-dlg-hor', panelCaption: this.textHorAxis}, {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}, {panelId: 'id-chart-settings-dlg-alttext', panelCaption: this.textAlt} ], contentTemplate: _.template(contentTemplate)({ scope: this }) }, options); this.options.handler = function(result, value) { if ( result != 'ok' || this.isRangeValid() ) { if (options.handler) options.handler.call(this, result, value); return; } return true; }; Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); this._state = { ChartType: Asc.c_oAscChartTypeSettings.barNormal, SparkType: -1 }; this._noApply = true; this._changedProps = null; this._changedImageProps = null; this.api = this.options.api; this.chartSettings = this.options.chartSettings; this.imageSettings = this.options.imageSettings; this.sparklineStyles = this.options.sparklineStyles; this.isChart = this.options.isChart; this.vertAxisProps = null; this.horAxisProps = null; this.currentAxisProps = null; this.dataRangeValid = ''; this.sparkDataRangeValid = ''; this.dataLocationRangeValid = ''; this.currentChartType = this._state.ChartType; this.storageName = (this.isChart) ? 'sse-chart-settings-adv-category' : 'sse-spark-settings-adv-category'; }, render: function() { Common.Views.AdvancedSettingsWindow.prototype.render.call(this); var me = this; var $window = this.getChild(); // Layout 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: $('#id-chart-dlg-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-dlg-button-type')); 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 } ] }); 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 } ] }); 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 } ] }).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 } ] }).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 } ] }).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 } ] }).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 } ] }).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 } ] }).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 } ] }); 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 }); this.chSeriesName = new Common.UI.CheckBox({ el: $('#chart-dlg-check-series'), labelText: this.textSeriesName }); this.chCategoryName = new Common.UI.CheckBox({ el: $('#chart-dlg-check-category'), labelText: this.textCategoryName }); this.chValue = new Common.UI.CheckBox({ el: $('#chart-dlg-check-value'), labelText: this.textValue }); 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 } ] }).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)); 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'); }, this)); this.lblLines = $('#chart-dlg-label-lines'); // Vertical Axis 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} ] }).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); } } }, this)); 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} ] }).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); } } }, this)); 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} ] }).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; } } }, this)); 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)); 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} ] }).on('selected', _.bind(function(combo, record) { if (this.currentAxisProps) { this.currentAxisProps.putDispUnitsRule(record.value); } }, this)); 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} ] }).on('selected', _.bind(function(combo, record) { if (this.currentAxisProps) { this.currentAxisProps.putMajorTickMark(record.value); } }, this)); 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} ] }).on('selected', _.bind(function(combo, record) { if (this.currentAxisProps) { this.currentAxisProps.putMinorTickMark(record.value); } }, this)); 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} ] }).on('selected', _.bind(function(combo, record) { if (this.currentAxisProps) { this.currentAxisProps.putTickLabelsPos(record.value); } }, this)); // Horizontal Axis 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} ] }).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); } } }, this)); 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)); 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} ] }).on('selected', _.bind(function(combo, record) { if (this.currentAxisProps) { this.currentAxisProps.putLabelsPosition(record.value); } }, this)); 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)); 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} ] }).on('selected', _.bind(function(combo, record) { if (this.currentAxisProps) { this.currentAxisProps.putMajorTickMark(record.value); } }, this)); 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} ] }).on('selected', _.bind(function(combo, record) { if (this.currentAxisProps) { this.currentAxisProps.putMinorTickMark(record.value); } }, this)); 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)); 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} ] }).on('selected', _.bind(function(combo, record) { if (this.currentAxisProps) { this.currentAxisProps.putTickLabelsPos(record.value); } }, this)); 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)); 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)); 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} ] }).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)); this.btnsCategory[3].on('click', _.bind(this.onVCategoryClick, this)); this.btnsCategory[4].on('click', _.bind(this.onHCategoryClick, this)); // Sparklines this.btnSparkType = new Common.UI.Button({ cls : 'btn-large-dataview', iconCls : 'svgicon chart-spark-column', menu : new Common.UI.Menu({ style: 'width: 167px; padding-top: 12px;', additionalAlign: this.menuAddAlign, items: [ { template: _.template('') } ] }) }); this.btnSparkType.on('render:after', function(btn) { me.mnuSparkTypePicker = new Common.UI.DataView({ el: $('#id-spark-dlg-menu-type'), parentMenu: btn.menu, restoreHeight: 120, groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getSparkGroupData()), store: new Common.UI.DataViewStore(Common.define.chartData.getSparkData()), itemTemplate: _.template('') }); }); this.btnSparkType.render($('#spark-dlg-button-type')); this.mnuSparkTypePicker.on('item:click', _.bind(this.onSelectSparkType, this, this.btnSparkType)); this.cmbSparkStyle = new Common.UI.ComboDataView({ itemWidth: 50, itemHeight: 50, menuMaxHeight: 272, enableKeyEvents: true, cls: 'combo-spark-style', minWidth: 190 }); this.cmbSparkStyle.render($('#spark-dlg-combo-style')); this.cmbSparkStyle.openButton.menu.cmpEl.css({ 'min-width': 178, 'max-width': 178 }); this.cmbSparkStyle.on('click', _.bind(this.onSelectSparkStyle, this)); this.cmbSparkStyle.openButton.menu.on('show:after', function () { me.cmbSparkStyle.menuPicker.scroller.update({alwaysVisibleY: true}); }); /* this.radioGroup = new Common.UI.RadioBox({ el: $('#spark-dlg-radio-group'), labelText: this.textGroup, name: 'asc-radio-sparkline', checked: true }); this.radioSingle = new Common.UI.RadioBox({ el: $('#spark-dlg-radio-single'), labelText: this.textSingle, name: 'asc-radio-sparkline' }); this.txtSparkDataRange = new Common.UI.InputFieldBtn({ el : $('#spark-dlg-txt-range'), name : 'range', style : 'width: 100%;', btnHint : this.textSelectData, allowBlank : true, blankError : this.txtEmpty, validateOnChange: true }); this.txtSparkDataRange.on('button:click', _.bind(this.onSelectSparkData, this)); this.txtSparkDataLocation = new Common.UI.InputFieldBtn({ el : $('#spark-dlg-txt-location'), name : 'range', style : 'width: 100%;', btnHint : this.textSelectData, allowBlank : true, blankError : this.txtEmpty, validateOnChange: true }); this.txtSparkDataLocation.on('button:click', _.bind(this.onSelectLocationData, this)); */ this._arrEmptyCells = [ { value: Asc.c_oAscEDispBlanksAs.Gap, displayValue: this.textGaps }, { value: Asc.c_oAscEDispBlanksAs.Zero, displayValue: this.textZero }, { value: Asc.c_oAscEDispBlanksAs.Span, displayValue: this.textEmptyLine } ]; this.cmbEmptyCells = new Common.UI.ComboBox({ el : $('#spark-dlg-combo-empty'), menuStyle : 'min-width: 220px;', editable : false, cls : 'input-group-nr' }); this.cmbEmptyCells.on('selected', _.bind(function(combo, record){ if (this._changedProps) { this._changedProps.asc_setDisplayEmpty(record.value); } }, this)); this.chShowEmpty = new Common.UI.CheckBox({ el: $('#spark-dlg-check-show-data'), labelText: this.textShowData }); this.chShowEmpty.on('change', _.bind(function(field, newValue, oldValue, eOpts){ if (this._changedProps) { this._changedProps.asc_setDisplayHidden(field.getValue()=='checked'); } }, this)); // Sparkline axis this.chShowAxis = new Common.UI.CheckBox({ el: $('#spark-dlg-check-show'), labelText: this.textShowSparkAxis }); this.chShowAxis.on('change', _.bind(function(field, newValue, oldValue, eOpts){ if (this._changedProps) { this._changedProps.asc_setDisplayXAxis(field.getValue()=='checked'); } }, this)); this.chReverse = new Common.UI.CheckBox({ el: $('#spark-dlg-check-reverse'), labelText: this.textReverseOrder }); this.chReverse.on('change', _.bind(function(field, newValue, oldValue, eOpts){ if (this._changedProps) { this._changedProps.asc_setRightToLeft(field.getValue()=='checked'); } }, this)); this.cmbSparkMinType = new Common.UI.ComboBox({ el : $('#spark-dlg-combo-mintype'), cls : 'input-group-nr', menuStyle : 'min-width: 100px;', editable : false, data : [ {displayValue: this.textAutoEach, value: Asc.c_oAscSparklineAxisMinMax.Individual}, {displayValue: this.textSameAll, value: Asc.c_oAscSparklineAxisMinMax.Group}, {displayValue: this.textFixed, value: Asc.c_oAscSparklineAxisMinMax.Custom} ] }).on('selected', _.bind(function(combo, record) { this.spnSparkMinValue.setDisabled(record.value!==Asc.c_oAscSparklineAxisMinMax.Custom); if (this._changedProps) { this._changedProps.asc_setMinAxisType(record.value); } if (record.value==Asc.c_oAscSparklineAxisMinMax.Custom && _.isEmpty(this.spnSparkMinValue.getValue())) this.spnSparkMinValue.setValue(0); }, this)); this.spnSparkMinValue = new Common.UI.MetricSpinner({ el : $('#spark-dlg-input-min-value'), maxValue : 1000000, minValue : -1000000, step : 0.1, defaultUnit : "", defaultValue : 0, value : '' }).on('change', _.bind(function(field, newValue, oldValue) { if (this._changedProps) { this._changedProps.asc_setManualMin(field.getNumberValue()); } }, this)); this.cmbSparkMaxType = new Common.UI.ComboBox({ el : $('#spark-dlg-combo-maxtype'), cls : 'input-group-nr', menuStyle : 'min-width: 100px;', editable : false, data : [ {displayValue: this.textAutoEach, value: Asc.c_oAscSparklineAxisMinMax.Individual}, {displayValue: this.textSameAll, value: Asc.c_oAscSparklineAxisMinMax.Group}, {displayValue: this.textFixed, value: Asc.c_oAscSparklineAxisMinMax.Custom} ] }).on('selected', _.bind(function(combo, record) { this.spnSparkMaxValue.setDisabled(record.value!==Asc.c_oAscSparklineAxisMinMax.Custom); if (this._changedProps) { this._changedProps.asc_setMaxAxisType(record.value); } if (record.value==Asc.c_oAscSparklineAxisMinMax.Custom && _.isEmpty(this.spnSparkMaxValue.getValue())) this.spnSparkMaxValue.setValue(0); }, this)); this.spnSparkMaxValue = new Common.UI.MetricSpinner({ el : $('#spark-dlg-input-max-value'), maxValue : 1000000, minValue : -1000000, step : 0.1, defaultUnit : "", defaultValue : 0, value : '' }).on('change', _.bind(function(field, newValue, oldValue) { if (this._changedProps) { this._changedProps.asc_setManualMax(field.getNumberValue()); } }, this)); // Snapping this.radioTwoCell = new Common.UI.RadioBox({ el: $('#chart-dlg-radio-twocell'), name: 'asc-radio-snap', labelText: this.textTwoCell, value: AscCommon.c_oAscCellAnchorType.cellanchorTwoCell }); this.radioTwoCell.on('change', _.bind(this.onRadioSnapChange, this)); this.radioOneCell = new Common.UI.RadioBox({ el: $('#chart-dlg-radio-onecell'), name: 'asc-radio-snap', labelText: this.textOneCell, value: AscCommon.c_oAscCellAnchorType.cellanchorOneCell }); this.radioOneCell.on('change', _.bind(this.onRadioSnapChange, this)); this.radioAbsolute = new Common.UI.RadioBox({ el: $('#chart-dlg-radio-absolute'), name: 'asc-radio-snap', labelText: this.textAbsolute, value: AscCommon.c_oAscCellAnchorType.cellanchorAbsolute }); this.radioAbsolute.on('change', _.bind(this.onRadioSnapChange, this)); // Alt Text this.inputAltTitle = new Common.UI.InputField({ el : $('#chart-advanced-alt-title'), allowBlank : true, validateOnBlur: false, style : 'width: 100%;' }).on('changed:after', function() { me.isAltTitleChanged = true; }); this.textareaAltDescription = this.$window.find('textarea'); this.textareaAltDescription.keydown(function (event) { if (event.keyCode == Common.UI.Keys.RETURN) { event.stopPropagation(); } me.isAltDescChanged = true; }); // Chart data this.seriesList = new Common.UI.ListView({ el: $('#chart-dlg-series-list', this.$window), store: new Common.UI.DataViewStore(), emptyText: '', scrollAlwaysVisible: true, template: _.template([''].join('')), itemTemplate: _.template([ '