2016-04-01 13:17:09 +00:00
/ *
*
2019-01-17 13:05:03 +00:00
* ( c ) Copyright Ascensio System SIA 2010 - 2019
2016-04-01 13:17:09 +00:00
*
* 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
*
2019-01-17 13:00:34 +00:00
* You can contact Ascensio System SIA at 20 A - 12 Ernesta Birznieka - Upisha
* street , Riga , Latvia , EU , LV - 1050.
2016-04-01 13:17:09 +00:00
*
* 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
*
* /
2016-03-11 00:48:53 +00:00
/ * *
* ChartSettingsDlg . js
*
* Created by Julia Radzhabova on 4 / 04 / 14
2018-03-01 12:16:38 +00:00
* Copyright ( c ) 2018 Ascensio System SIA . All rights reserved .
2016-03-11 00:48:53 +00:00
*
* /
define ( [ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' ,
'common/main/lib/view/AdvancedSettingsWindow' ,
'common/main/lib/component/CheckBox' ,
'common/main/lib/component/InputField' ,
2020-07-02 15:10:27 +00:00
'spreadsheeteditor/main/app/view/CellRangeDialog' ,
2020-12-07 13:22:18 +00:00
'spreadsheeteditor/main/app/view/ChartDataRangeDialog' ,
'spreadsheeteditor/main/app/view/FormatSettingsDialog'
2016-03-11 00:48:53 +00:00
] , function ( contentTemplate ) {
'use strict' ;
SSE . Views . ChartSettingsDlg = Common . Views . AdvancedSettingsWindow . extend ( _ . extend ( {
options : {
2022-08-23 12:09:52 +00:00
contentWidth : 327 ,
2016-03-11 00:48:53 +00:00
height : 535 ,
2016-04-21 11:47:28 +00:00
toggleGroup : 'chart-settings-dlg-group' ,
storageName : 'sse-chart-settings-adv-category'
2016-03-11 00:48:53 +00:00
} ,
initialize : function ( options ) {
_ . extend ( this . options , {
title : this . textTitle ,
items : [
2020-07-08 13:07:57 +00:00
{ panelId : 'id-chart-settings-dlg-style' , panelCaption : this . textType } ,
2016-03-11 00:48:53 +00:00
{ panelId : 'id-chart-settings-dlg-layout' , panelCaption : this . textLayout } ,
{ panelId : 'id-chart-settings-dlg-vert' , panelCaption : this . textVertAxis } ,
2020-12-05 20:42:28 +00:00
{ panelId : 'id-chart-settings-dlg-vert-sec' , panelCaption : this . textVertAxisSec } ,
2016-09-14 13:34:08 +00:00
{ panelId : 'id-chart-settings-dlg-hor' , panelCaption : this . textHorAxis } ,
2020-12-05 20:42:28 +00:00
{ panelId : 'id-chart-settings-dlg-hor-sec' , panelCaption : this . textHorAxisSec } ,
2016-09-14 13:34:08 +00:00
{ panelId : 'id-spark-settings-dlg-style' , panelCaption : this . textTypeData } ,
2017-01-18 19:26:05 +00:00
{ panelId : 'id-spark-settings-dlg-axis' , panelCaption : this . textAxisOptions } ,
2019-10-03 13:56:19 +00:00
{ panelId : 'id-chart-settings-dlg-snap' , panelCaption : this . textSnap } ,
2017-01-18 19:26:05 +00:00
{ panelId : 'id-chart-settings-dlg-alttext' , panelCaption : this . textAlt }
2016-03-11 00:48:53 +00:00
] ,
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 = {
2016-09-20 11:46:36 +00:00
ChartType : Asc . c _oAscChartTypeSettings . barNormal ,
SparkType : - 1
2016-03-11 00:48:53 +00:00
} ;
this . _noApply = true ;
2016-10-27 07:35:19 +00:00
this . _changedProps = null ;
2019-10-03 13:56:19 +00:00
this . _changedImageProps = null ;
2016-03-11 00:48:53 +00:00
this . api = this . options . api ;
this . chartSettings = this . options . chartSettings ;
2017-01-18 19:26:05 +00:00
this . imageSettings = this . options . imageSettings ;
2017-04-11 11:05:56 +00:00
this . sparklineStyles = this . options . sparklineStyles ;
2016-09-14 13:34:08 +00:00
this . isChart = this . options . isChart ;
2020-10-09 11:20:31 +00:00
this . isDiagramMode = ! ! this . options . isDiagramMode ;
2020-12-05 20:42:28 +00:00
this . vertAxisProps = [ ] ;
this . horAxisProps = [ ] ;
this . currentAxisProps = [ ] ;
2016-03-11 00:48:53 +00:00
this . dataRangeValid = '' ;
2016-12-13 12:54:58 +00:00
this . sparkDataRangeValid = '' ;
this . dataLocationRangeValid = '' ;
2016-08-18 11:17:05 +00:00
this . currentChartType = this . _state . ChartType ;
2016-09-14 13:34:08 +00:00
this . storageName = ( this . isChart ) ? 'sse-chart-settings-adv-category' : 'sse-spark-settings-adv-category' ;
2016-03-11 00:48:53 +00:00
} ,
render : function ( ) {
Common . Views . AdvancedSettingsWindow . prototype . render . call ( this ) ;
var me = this ;
var $window = this . getChild ( ) ;
// Layout
2020-10-09 11:20:31 +00:00
if ( this . isDiagramMode ) {
this . btnChartType = new Common . UI . Button ( {
2020-12-05 20:42:28 +00:00
cls : 'btn-large-dataview' ,
iconCls : 'svgicon chart-bar-normal' ,
menu : new Common . UI . Menu ( {
2021-01-14 09:57:22 +00:00
style : 'width: 364px;' ,
2020-10-09 11:20:31 +00:00
additionalAlign : this . menuAddAlign ,
items : [
2021-01-14 09:57:22 +00:00
{ template : _ . template ( '<div id="id-chart-dlg-menu-type" class="menu-insertchart"></div>' ) }
2020-10-09 11:20:31 +00:00
]
} )
} ) ;
2020-12-05 20:42:28 +00:00
this . btnChartType . on ( 'render:after' , function ( btn ) {
2020-10-09 11:20:31 +00:00
me . mnuChartTypePicker = new Common . UI . DataView ( {
el : $ ( '#id-chart-dlg-menu-type' ) ,
parentMenu : btn . menu ,
2021-01-14 09:57:22 +00:00
restoreHeight : 465 ,
2020-10-09 11:20:31 +00:00
groups : new Common . UI . DataViewGroupStore ( Common . define . chartData . getChartGroupData ( ) ) ,
store : new Common . UI . DataViewStore ( Common . define . chartData . getChartData ( ) ) ,
itemTemplate : _ . template ( '<div id="<%= id %>" class="item-chartlist"><svg width="40" height="40" class=\"icon\"><use xlink:href=\"#chart-<%= iconCls %>\"></use></svg></div>' )
} ) ;
} ) ;
this . btnChartType . render ( $ ( '#chart-dlg-button-type' ) ) ;
this . mnuChartTypePicker . on ( 'item:click' , _ . bind ( this . onSelectType , this , this . btnChartType ) ) ;
}
2016-03-11 00:48:53 +00:00
this . cmbChartTitle = new Common . UI . ComboBox ( {
2020-12-05 20:42:28 +00:00
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 }
2020-10-14 10:43:44 +00:00
] ,
takeFocusOnClose : true
2016-03-11 00:48:53 +00:00
} ) ;
this . cmbLegendPos = new Common . UI . ComboBox ( {
2020-12-05 20:42:28 +00:00
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 }
2020-10-14 10:43:44 +00:00
] ,
takeFocusOnClose : true
2016-03-11 00:48:53 +00:00
} ) ;
this . cmbDataLabels = new Common . UI . ComboBox ( {
2020-12-05 20:42:28 +00:00
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 }
2020-10-14 10:43:44 +00:00
] ,
takeFocusOnClose : true
2016-03-11 00:48:53 +00:00
} ) ;
this . cmbDataLabels . on ( 'selected' , _ . bind ( me . onSelectDataLabels , this ) ) ;
this . txtSeparator = new Common . UI . InputField ( {
2020-12-05 20:42:28 +00:00
el : $ ( '#chart-dlg-txt-separator' ) ,
name : 'range' ,
style : 'width: 100%;' ,
allowBlank : true ,
blankError : this . txtEmpty
2016-03-11 00:48:53 +00:00
} ) ;
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 ( {
2020-12-05 20:42:28 +00:00
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 }
2020-10-14 10:43:44 +00:00
] ,
takeFocusOnClose : true
2020-12-05 20:42:28 +00:00
} ) . on ( 'selected' , _ . bind ( function ( combo , record ) {
2016-03-11 00:48:53 +00:00
if ( this . chartSettings ) {
2020-12-05 20:42:28 +00:00
this . chartSettings . putLine ( record . value !== 0 ) ;
if ( record . value > 0 )
this . chartSettings . putSmooth ( record . value == 2 ) ;
2016-03-11 00:48:53 +00:00
}
} , this ) ) ;
this . chMarkers = new Common . UI . CheckBox ( {
el : $ ( '#chart-dlg-check-markers' ) ,
labelText : this . textMarkers
2020-12-05 20:42:28 +00:00
} ) . on ( 'change' , _ . bind ( function ( checkbox , state ) {
if ( this . chartSettings )
this . chartSettings . putShowMarker ( state == 'checked' ) ;
2016-03-11 00:48:53 +00:00
} , this ) ) ;
this . lblLines = $ ( '#chart-dlg-label-lines' ) ;
// Vertical Axis
2020-12-05 20:42:28 +00:00
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 = [ ] ;
2020-12-07 13:22:18 +00:00
this . btnVFormat = [ ] ;
2022-03-09 19:36:47 +00:00
this . chVLogScale = [ ] ;
this . spnBase = [ ] ;
2020-12-05 20:42:28 +00:00
2021-05-04 11:08:26 +00:00
this . _arrVertTitle = [
{ value : Asc . c _oAscChartVertAxisLabelShowSettings . none , displayValue : me . textNone } ,
{ value : Asc . c _oAscChartVertAxisLabelShowSettings . rotated , displayValue : me . textRotated } ,
{ value : Asc . c _oAscChartVertAxisLabelShowSettings . horizontal , displayValue : me . textHorizontal }
] ;
2020-12-05 20:42:28 +00:00
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' ,
2021-05-04 11:08:26 +00:00
data : me . _arrVertTitle ,
2020-12-05 20:42:28 +00:00
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 ) ;
}
2016-03-11 00:48:53 +00:00
}
2020-12-05 20:42:28 +00:00
} , me ) ) ;
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 ( ) ) ;
2016-03-11 00:48:53 +00:00
}
2020-12-05 20:42:28 +00:00
} , me ) ) ;
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 ) ;
}
2016-03-11 00:48:53 +00:00
}
2020-12-05 20:42:28 +00:00
} , me ) ) ;
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 ) ) ;
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 :
2021-04-28 17:00:45 +00:00
me . spnVAxisCrosses [ i ] . setValue ( me . spnMinValue [ i ] . getNumberValue ( ) , true ) ;
2020-12-05 20:42:28 +00:00
break ;
case Asc . c _oAscCrossesRule . maxValue :
2021-04-28 17:00:45 +00:00
me . spnVAxisCrosses [ i ] . setValue ( me . spnMaxValue [ i ] . getNumberValue ( ) , true ) ;
2020-12-05 20:42:28 +00:00
break ;
case Asc . c _oAscCrossesRule . auto :
me . spnVAxisCrosses [ i ] . setValue ( me . _originalAxisVValues [ i ] . crossesAuto , true ) ;
break ;
}
}
} , me ) ) ;
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 ) ) ;
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 ) ) ;
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' ,
2020-12-07 13:22:18 +00:00
menuStyle : 'min-width: 100%;' ,
2020-12-05 20:42:28 +00:00
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 ) ) ;
2020-12-07 13:22:18 +00:00
me . btnVFormat [ i ] = new Common . UI . Button ( {
el : $ ( '#chart-dlg-btn-v-format-' + i )
2020-12-07 19:20:22 +00:00
} ) . on ( 'click' , _ . bind ( me . openFormat , me , i ) ) ;
2022-03-09 19:36:47 +00:00
me . chVLogScale [ i ] = new Common . UI . CheckBox ( {
el : $ ( '#chart-dlg-check-v-logscale-' + i ) ,
labelText : me . textLogScale
} ) . on ( 'change' , _ . bind ( function ( checkbox , state ) {
if ( me . currentAxisProps [ i ] ) {
me . currentAxisProps [ i ] . putLogScale ( state == 'checked' ) ;
( state == 'checked' ) && me . currentAxisProps [ i ] . putLogBase ( me . spnBase [ i ] . getNumberValue ( ) ) ;
}
me . spnBase [ i ] . setDisabled ( ( state !== 'checked' ) ) ;
} , me ) ) ;
me . spnBase [ i ] = new Common . UI . MetricSpinner ( {
el : $ ( '#chart-dlg-input-base-' + i ) ,
maxValue : 1000 ,
minValue : 2 ,
step : 1 ,
defaultUnit : "" ,
value : 10
} ) . on ( 'change' , _ . bind ( function ( field , newValue , oldValue ) {
if ( me . currentAxisProps [ i ] ) {
me . currentAxisProps [ i ] . putLogBase ( field . getNumberValue ( ) ) ;
}
} , me ) ) ;
2020-12-05 20:42:28 +00:00
} ;
addControlsV ( 0 ) ;
addControlsV ( 1 ) ;
2016-03-11 00:48:53 +00:00
// Horizontal Axis
2020-12-05 20:42:28 +00:00
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 = [ ] ;
2020-12-07 13:22:18 +00:00
this . btnHFormat = [ ] ;
2020-12-05 20:42:28 +00:00
2021-05-04 11:08:26 +00:00
this . _arrHorTitle = [
{ value : Asc . c _oAscChartHorAxisLabelShowSettings . none , displayValue : me . textNone } ,
{ value : Asc . c _oAscChartHorAxisLabelShowSettings . noOverlay , displayValue : me . textNoOverlay }
] ;
2020-12-05 20:42:28 +00:00
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' ,
2021-05-04 11:08:26 +00:00
data : me . _arrHorTitle ,
2020-12-05 20:42:28 +00:00
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 ) ;
}
2016-03-11 00:48:53 +00:00
}
2020-12-05 20:42:28 +00:00
} , me ) ) ;
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 ) ) ;
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 ) ) ;
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 ) ) ;
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 ) ) ;
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 ) ) ;
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 ) ) ;
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 ) ) ;
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 ) ) ;
me . spnLabelInterval [ i ] = new Common . UI . MetricSpinner ( {
el : $ ( '#chart-dlg-input-label-int-' + i ) ,
2020-12-07 13:22:18 +00:00
width : 60 ,
2020-12-05 20:42:28 +00:00
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 ) ) ;
me . cmbLabelInterval [ i ] = new Common . UI . ComboBox ( {
el : $ ( '#chart-dlg-combo-label-int-' + i ) ,
cls : 'input-group-nr' ,
2020-12-07 13:22:18 +00:00
menuStyle : 'min-width: 100px;' ,
2020-12-05 20:42:28 +00:00
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 ) ) ;
2020-12-07 13:22:18 +00:00
me . btnHFormat [ i ] = new Common . UI . Button ( {
el : $ ( '#chart-dlg-btn-h-format-' + i )
2020-12-07 19:20:22 +00:00
} ) . on ( 'click' , _ . bind ( me . openFormat , me , i ) ) ;
2020-12-05 20:42:28 +00:00
} ;
addControlsH ( 0 ) ;
addControlsH ( 1 ) ;
2016-03-11 00:48:53 +00:00
2016-09-14 13:34:08 +00:00
// Sparklines
this . btnSparkType = new Common . UI . Button ( {
cls : 'btn-large-dataview' ,
2020-05-06 15:04:48 +00:00
iconCls : 'svgicon chart-spark-column' ,
2016-09-14 13:34:08 +00:00
menu : new Common . UI . Menu ( {
2021-01-14 09:57:22 +00:00
style : 'width: 167px;' ,
2019-02-28 10:05:23 +00:00
additionalAlign : this . menuAddAlign ,
2016-09-14 13:34:08 +00:00
items : [
2021-01-14 09:57:22 +00:00
{ template : _ . template ( '<div id="id-spark-dlg-menu-type" class="menu-insertchart"></div>' ) }
2016-09-14 13:34:08 +00:00
]
} )
} ) ;
this . btnSparkType . on ( 'render:after' , function ( btn ) {
me . mnuSparkTypePicker = new Common . UI . DataView ( {
el : $ ( '#id-spark-dlg-menu-type' ) ,
parentMenu : btn . menu ,
2016-12-16 08:37:57 +00:00
restoreHeight : 120 ,
2019-11-18 10:40:10 +00:00
groups : new Common . UI . DataViewGroupStore ( Common . define . chartData . getSparkGroupData ( ) ) ,
store : new Common . UI . DataViewStore ( Common . define . chartData . getSparkData ( ) ) ,
2020-05-06 15:04:48 +00:00
itemTemplate : _ . template ( '<div id="<%= id %>" class="item-chartlist"><svg width="40" height="40" class=\"icon\"><use xlink:href=\"#chart-<%= iconCls %>\"></use></svg></div>' )
2016-09-14 13:34:08 +00:00
} ) ;
} ) ;
this . btnSparkType . render ( $ ( '#spark-dlg-button-type' ) ) ;
this . mnuSparkTypePicker . on ( 'item:click' , _ . bind ( this . onSelectSparkType , this , this . btnSparkType ) ) ;
2016-09-28 12:21:36 +00:00
this . cmbSparkStyle = new Common . UI . ComboDataView ( {
itemWidth : 50 ,
itemHeight : 50 ,
menuMaxHeight : 272 ,
enableKeyEvents : true ,
2017-04-11 11:05:56 +00:00
cls : 'combo-spark-style' ,
minWidth : 190
2016-09-14 13:34:08 +00:00
} ) ;
2016-09-28 12:21:36 +00:00
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 } ) ;
2016-09-14 13:34:08 +00:00
} ) ;
2016-11-22 07:46:19 +00:00
/ *
2016-09-14 13:34:08 +00:00
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'
} ) ;
2017-04-11 11:05:56 +00:00
2020-04-06 14:46:22 +00:00
this . txtSparkDataRange = new Common . UI . InputFieldBtn ( {
2016-09-14 13:34:08 +00:00
el : $ ( '#spark-dlg-txt-range' ) ,
name : 'range' ,
style : 'width: 100%;' ,
2020-04-06 14:46:22 +00:00
btnHint : this . textSelectData ,
2016-09-14 13:34:08 +00:00
allowBlank : true ,
blankError : this . txtEmpty ,
validateOnChange : true
} ) ;
2020-04-06 14:46:22 +00:00
this . txtSparkDataRange . on ( 'button:click' , _ . bind ( this . onSelectSparkData , this ) ) ;
2016-09-14 13:34:08 +00:00
2020-04-06 14:46:22 +00:00
this . txtSparkDataLocation = new Common . UI . InputFieldBtn ( {
2016-09-14 13:34:08 +00:00
el : $ ( '#spark-dlg-txt-location' ) ,
name : 'range' ,
style : 'width: 100%;' ,
2020-04-06 14:46:22 +00:00
btnHint : this . textSelectData ,
2016-09-14 13:34:08 +00:00
allowBlank : true ,
blankError : this . txtEmpty ,
validateOnChange : true
} ) ;
2020-04-06 14:46:22 +00:00
this . txtSparkDataLocation . on ( 'button:click' , _ . bind ( this . onSelectLocationData , this ) ) ;
2017-04-11 11:05:56 +00:00
* /
2016-11-30 14:08:26 +00:00
2016-09-20 11:46:36 +00:00
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 }
] ;
2016-09-14 13:34:08 +00:00
this . cmbEmptyCells = new Common . UI . ComboBox ( {
el : $ ( '#spark-dlg-combo-empty' ) ,
2017-07-04 08:00:37 +00:00
menuStyle : 'min-width: 220px;' ,
2016-09-14 13:34:08 +00:00
editable : false ,
2020-10-14 10:43:44 +00:00
cls : 'input-group-nr' ,
takeFocusOnClose : true
2016-09-14 13:34:08 +00:00
} ) ;
2016-10-27 07:35:19 +00:00
this . cmbEmptyCells . on ( 'selected' , _ . bind ( function ( combo , record ) {
if ( this . _changedProps ) {
this . _changedProps . asc _setDisplayEmpty ( record . value ) ;
}
} , this ) ) ;
2016-09-14 13:34:08 +00:00
this . chShowEmpty = new Common . UI . CheckBox ( {
el : $ ( '#spark-dlg-check-show-data' ) ,
labelText : this . textShowData
} ) ;
2016-10-27 07:35:19 +00:00
this . chShowEmpty . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
this . _changedProps . asc _setDisplayHidden ( field . getValue ( ) == 'checked' ) ;
}
} , this ) ) ;
2016-09-14 13:34:08 +00:00
// Sparkline axis
this . chShowAxis = new Common . UI . CheckBox ( {
el : $ ( '#spark-dlg-check-show' ) ,
labelText : this . textShowSparkAxis
} ) ;
2016-10-27 07:35:19 +00:00
this . chShowAxis . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
this . _changedProps . asc _setDisplayXAxis ( field . getValue ( ) == 'checked' ) ;
}
} , this ) ) ;
2016-09-14 13:34:08 +00:00
this . chReverse = new Common . UI . CheckBox ( {
el : $ ( '#spark-dlg-check-reverse' ) ,
labelText : this . textReverseOrder
} ) ;
2016-10-27 07:35:19 +00:00
this . chReverse . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
this . _changedProps . asc _setRightToLeft ( field . getValue ( ) == 'checked' ) ;
}
} , this ) ) ;
2016-09-14 13:34:08 +00:00
this . cmbSparkMinType = new Common . UI . ComboBox ( {
el : $ ( '#spark-dlg-combo-mintype' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 100px;' ,
editable : false ,
data : [
2016-09-20 11:46:36 +00:00
{ displayValue : this . textAutoEach , value : Asc . c _oAscSparklineAxisMinMax . Individual } ,
{ displayValue : this . textSameAll , value : Asc . c _oAscSparklineAxisMinMax . Group } ,
{ displayValue : this . textFixed , value : Asc . c _oAscSparklineAxisMinMax . Custom }
2020-10-14 10:43:44 +00:00
] ,
takeFocusOnClose : true
2016-09-14 13:34:08 +00:00
} ) . on ( 'selected' , _ . bind ( function ( combo , record ) {
2016-09-20 11:46:36 +00:00
this . spnSparkMinValue . setDisabled ( record . value !== Asc . c _oAscSparklineAxisMinMax . Custom ) ;
2016-10-27 07:35:19 +00:00
if ( this . _changedProps ) {
this . _changedProps . asc _setMinAxisType ( record . value ) ;
}
if ( record . value == Asc . c _oAscSparklineAxisMinMax . Custom && _ . isEmpty ( this . spnSparkMinValue . getValue ( ) ) )
this . spnSparkMinValue . setValue ( 0 ) ;
2016-09-14 13:34:08 +00:00
} , 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 ) {
2016-10-27 07:35:19 +00:00
if ( this . _changedProps ) {
this . _changedProps . asc _setManualMin ( field . getNumberValue ( ) ) ;
}
2016-09-14 13:34:08 +00:00
} , this ) ) ;
this . cmbSparkMaxType = new Common . UI . ComboBox ( {
el : $ ( '#spark-dlg-combo-maxtype' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 100px;' ,
editable : false ,
data : [
2016-09-20 11:46:36 +00:00
{ displayValue : this . textAutoEach , value : Asc . c _oAscSparklineAxisMinMax . Individual } ,
{ displayValue : this . textSameAll , value : Asc . c _oAscSparklineAxisMinMax . Group } ,
{ displayValue : this . textFixed , value : Asc . c _oAscSparklineAxisMinMax . Custom }
2020-10-14 10:43:44 +00:00
] ,
takeFocusOnClose : true
2016-09-14 13:34:08 +00:00
} ) . on ( 'selected' , _ . bind ( function ( combo , record ) {
2016-09-20 11:46:36 +00:00
this . spnSparkMaxValue . setDisabled ( record . value !== Asc . c _oAscSparklineAxisMinMax . Custom ) ;
2016-10-27 07:35:19 +00:00
if ( this . _changedProps ) {
this . _changedProps . asc _setMaxAxisType ( record . value ) ;
}
if ( record . value == Asc . c _oAscSparklineAxisMinMax . Custom && _ . isEmpty ( this . spnSparkMaxValue . getValue ( ) ) )
this . spnSparkMaxValue . setValue ( 0 ) ;
2016-09-14 13:34:08 +00:00
} , 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 ) {
2016-10-27 07:35:19 +00:00
if ( this . _changedProps ) {
this . _changedProps . asc _setManualMax ( field . getNumberValue ( ) ) ;
}
2016-09-14 13:34:08 +00:00
} , this ) ) ;
2019-10-03 13:56:19 +00:00
// 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 ) ) ;
2017-01-18 19:26:05 +00:00
// 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 ;
} ) ;
2016-03-11 00:48:53 +00:00
this . afterRender ( ) ;
} ,
2020-10-14 10:43:44 +00:00
getFocusedComponents : function ( ) {
return [
2021-04-13 22:12:59 +00:00
this . cmbChartTitle , this . cmbLegendPos , this . cmbDataLabels , this . chSeriesName , this . chCategoryName , this . chValue , this . txtSeparator , // 1 tab
2020-12-05 20:42:28 +00:00
this . cmbVertTitle [ 0 ] , this . cmbVertGrid [ 0 ] ,
2021-04-13 22:12:59 +00:00
this . chVertHide [ 0 ] , this . cmbMinType [ 0 ] , this . spnMinValue [ 0 ] , this . cmbMaxType [ 0 ] , this . spnMaxValue [ 0 ] , this . cmbVCrossType [ 0 ] , this . spnVAxisCrosses [ 0 ] ,
2022-03-09 19:36:47 +00:00
this . cmbUnits [ 0 ] , this . chVReverse [ 0 ] , this . chVLogScale [ 0 ] , this . spnBase [ 0 ] , this . cmbVMajorType [ 0 ] , this . cmbVMinorType [ 0 ] , this . cmbVLabelPos [ 0 ] , // 2 tab
2020-12-05 20:42:28 +00:00
this . cmbVertTitle [ 1 ] , this . cmbVertGrid [ 1 ] ,
2021-04-13 22:12:59 +00:00
this . chVertHide [ 1 ] , this . cmbMinType [ 1 ] , this . spnMinValue [ 1 ] , this . cmbMaxType [ 1 ] , this . spnMaxValue [ 1 ] , this . cmbVCrossType [ 1 ] , this . spnVAxisCrosses [ 1 ] ,
2022-03-09 19:36:47 +00:00
this . cmbUnits [ 1 ] , this . chVReverse [ 1 ] , this . chVLogScale [ 1 ] , this . spnBase [ 1 ] , this . cmbVMajorType [ 1 ] , this . cmbVMinorType [ 1 ] , this . cmbVLabelPos [ 1 ] , // 3 tab
2021-04-13 22:12:59 +00:00
this . chHorHide [ 0 ] , this . cmbHorTitle [ 0 ] , this . cmbHorGrid [ 0 ] ,
this . cmbHCrossType [ 0 ] , this . spnHAxisCrosses [ 0 ] , this . cmbAxisPos [ 0 ] , this . chHReverse [ 0 ] , this . cmbHMajorType [ 0 ] , this . cmbHMinorType [ 0 ] , this . spnMarksInterval [ 0 ] ,
2020-12-05 20:42:28 +00:00
this . cmbHLabelPos [ 0 ] , this . spnLabelDist [ 0 ] , this . cmbLabelInterval [ 0 ] , this . spnLabelInterval [ 0 ] , // 4 tab
2021-04-13 22:12:59 +00:00
this . chHorHide [ 1 ] , this . cmbHorTitle [ 1 ] , this . cmbHorGrid [ 1 ] ,
this . cmbHCrossType [ 1 ] , this . spnHAxisCrosses [ 1 ] , this . cmbAxisPos [ 1 ] , this . chHReverse [ 1 ] , this . cmbHMajorType [ 1 ] , this . cmbHMinorType [ 1 ] , this . spnMarksInterval [ 1 ] ,
2020-12-05 20:42:28 +00:00
this . cmbHLabelPos [ 1 ] , this . spnLabelDist [ 1 ] , this . cmbLabelInterval [ 1 ] , this . spnLabelInterval [ 1 ] , // 5 tab
2021-04-13 22:12:59 +00:00
this . cmbEmptyCells , this . chShowEmpty , // 6 tab
this . chShowAxis , this . chReverse , this . cmbSparkMinType , this . spnSparkMinValue , this . cmbSparkMaxType , this . spnSparkMaxValue , // 7 tab
2021-04-14 15:16:27 +00:00
this . radioTwoCell , this . radioOneCell , this . radioAbsolute , // 8 tab
2021-04-13 22:12:59 +00:00
this . inputAltTitle , this . textareaAltDescription // 9 tab
2020-10-14 10:43:44 +00:00
] ;
} ,
onCategoryClick : function ( btn , index ) {
Common . Views . AdvancedSettingsWindow . prototype . onCategoryClick . call ( this , btn , index ) ;
var me = this ;
setTimeout ( function ( ) {
switch ( index ) {
case 1 :
me . cmbChartTitle . focus ( ) ;
break ;
case 2 :
case 3 :
2020-12-05 20:42:28 +00:00
me . onVCategoryClick ( index - 2 ) ;
me . cmbMinType [ index - 2 ] . focus ( ) ;
2020-10-14 10:43:44 +00:00
break ;
2020-12-05 20:42:28 +00:00
case 4 :
case 5 :
me . onHCategoryClick ( index - 4 ) ;
me . cmbHCrossType [ index - 4 ] . focus ( ) ;
break ;
2021-04-13 22:12:59 +00:00
case 6 :
me . cmbEmptyCells . focus ( ) ;
break ;
case 7 :
me . chShowAxis . focus ( ) ;
break ;
2021-04-14 15:16:27 +00:00
case 8 :
me . radioTwoCell . focus ( ) ;
break ;
2020-12-05 20:42:28 +00:00
case 9 :
2020-10-14 10:43:44 +00:00
me . inputAltTitle . focus ( ) ;
break ;
}
} , 10 ) ;
} ,
2016-03-11 00:48:53 +00:00
afterRender : function ( ) {
this . _setDefaults ( this . chartSettings ) ;
2016-09-14 13:34:08 +00:00
this . setTitle ( ( this . isChart ) ? this . textTitle : this . textTitleSparkline ) ;
2020-10-09 11:20:31 +00:00
this . btnsCategory [ 0 ] . setVisible ( this . isDiagramMode ) ; // hide type for charts
2016-09-14 13:34:08 +00:00
if ( this . isChart ) {
2020-12-05 20:42:28 +00:00
this . btnsCategory [ 6 ] . setVisible ( false ) ;
this . btnsCategory [ 7 ] . setVisible ( false ) ;
2016-09-14 13:34:08 +00:00
} else {
this . btnsCategory [ 1 ] . setVisible ( false ) ;
this . btnsCategory [ 2 ] . setVisible ( false ) ;
this . btnsCategory [ 3 ] . setVisible ( false ) ;
2020-12-05 20:42:28 +00:00
this . btnsCategory [ 4 ] . setVisible ( false ) ;
this . btnsCategory [ 5 ] . setVisible ( false ) ;
this . btnsCategory [ 8 ] . setVisible ( false ) ;
this . btnsCategory [ 9 ] . setVisible ( false ) ;
2016-09-14 13:34:08 +00:00
}
2016-04-21 11:47:28 +00:00
if ( this . storageName ) {
var value = Common . localStorage . getItem ( this . storageName ) ;
this . setActiveCategory ( ( value !== null ) ? parseInt ( value ) : 0 ) ;
2016-06-20 08:15:56 +00:00
value = this . getActiveCategory ( ) ;
2020-12-05 20:42:28 +00:00
if ( value == 2 || value == 3 ) this . onVCategoryClick ( value - 2 ) ;
else if ( value == 4 || value == 5 ) this . onHCategoryClick ( value - 4 ) ;
2016-04-21 11:47:28 +00:00
}
2016-03-11 00:48:53 +00:00
} ,
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 ;
}
} else {
rawData = record ;
}
2020-05-06 15:04:48 +00:00
this . btnChartType . setIconCls ( 'svgicon ' + 'chart-' + rawData . iconCls ) ;
2016-03-11 00:48:53 +00:00
this . chartSettings . changeType ( rawData . type ) ;
this . updateAxisProps ( rawData . type , true ) ;
2020-12-05 20:42:28 +00:00
this . vertAxisProps = this . chartSettings . getVertAxesProps ( ) ;
this . horAxisProps = this . chartSettings . getHorAxesProps ( ) ;
2016-08-18 11:17:05 +00:00
this . updateDataLabels ( rawData . type , this . cmbDataLabels . getValue ( ) ) ;
this . currentChartType = rawData . type ;
2016-03-11 00:48:53 +00:00
} ,
updateAxisProps : function ( type , isDefault ) {
2016-04-05 11:52:34 +00:00
var value = ( type == Asc . c _oAscChartTypeSettings . lineNormal || type == Asc . c _oAscChartTypeSettings . lineStacked ||
2021-01-14 09:57:22 +00:00
type == Asc . c _oAscChartTypeSettings . lineStackedPer || type == Asc . c _oAscChartTypeSettings . lineNormalMarker ||
type == Asc . c _oAscChartTypeSettings . lineStackedMarker || type == Asc . c _oAscChartTypeSettings . lineStackedPerMarker ||
type == Asc . c _oAscChartTypeSettings . scatter || type == Asc . c _oAscChartTypeSettings . scatterSmoothMarker || type == Asc . c _oAscChartTypeSettings . scatterSmooth ||
type == Asc . c _oAscChartTypeSettings . scatterLineMarker || type == Asc . c _oAscChartTypeSettings . scatterLine ) ;
2016-03-11 00:48:53 +00:00
this . chMarkers . setVisible ( value ) ;
this . cmbLines . setVisible ( value ) ;
this . lblLines . toggleClass ( 'hidden' , ! value ) ;
if ( value ) {
this . chMarkers . setValue ( this . chartSettings . getShowMarker ( ) , true ) ;
this . cmbLines . setValue ( this . chartSettings . getLine ( ) ? ( this . chartSettings . getSmooth ( ) ? 2 : 1 ) : 0 ) ;
}
2016-04-05 11:52:34 +00:00
value = ( type == Asc . c _oAscChartTypeSettings . pie || type == Asc . c _oAscChartTypeSettings . doughnut || type == Asc . c _oAscChartTypeSettings . pie3d ) ;
2020-07-06 17:01:11 +00:00
this . btnsCategory [ 2 ] . setDisabled ( value ) ;
2016-03-11 00:48:53 +00:00
this . btnsCategory [ 3 ] . setDisabled ( value ) ;
2020-12-05 20:42:28 +00:00
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 ) ;
2016-03-11 00:48:53 +00:00
2016-06-20 08:35:15 +00:00
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 ) ;
2020-12-05 20:42:28 +00:00
this . cmbAxisPos [ 0 ] . setDisabled ( value ) ;
this . cmbAxisPos [ 1 ] . setDisabled ( value ) ;
2016-06-20 08:35:15 +00:00
2016-04-05 11:52:34 +00:00
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 ) ;
2020-07-06 17:01:11 +00:00
this . btnsCategory [ 2 ] . options . contentTarget = ( value ) ? 'id-chart-settings-dlg-hor' : 'id-chart-settings-dlg-vert' ;
2021-01-14 09:57:22 +00:00
this . btnsCategory [ 4 ] . options . contentTarget = ( value || type == Asc . c _oAscChartTypeSettings . scatter || type == Asc . c _oAscChartTypeSettings . scatterSmoothMarker || type == Asc . c _oAscChartTypeSettings . scatterSmooth ||
type == Asc . c _oAscChartTypeSettings . scatterLineMarker || type == Asc . c _oAscChartTypeSettings . scatterLine ) ? 'id-chart-settings-dlg-vert' : 'id-chart-settings-dlg-hor' ;
2016-03-11 00:48:53 +00:00
} ,
2016-08-18 11:17:05 +00:00
updateDataLabels : function ( chartType , labelPos ) {
if ( chartType !== this . currentChartType ) {
var data = [ { value : Asc . c _oAscChartDataLabelsPos . none , displayValue : this . textNone } ,
{ value : Asc . c _oAscChartDataLabelsPos . ctr , displayValue : this . textCenter } ] ;
if ( chartType == Asc . c _oAscChartTypeSettings . barNormal || chartType == Asc . c _oAscChartTypeSettings . hBarNormal )
data . push ( { value : Asc . c _oAscChartDataLabelsPos . inBase , displayValue : this . textInnerBottom } ,
{ value : Asc . c _oAscChartDataLabelsPos . inEnd , displayValue : this . textInnerTop } ,
{ value : Asc . c _oAscChartDataLabelsPos . outEnd , displayValue : this . textOuterTop } ) ;
else if ( chartType == Asc . c _oAscChartTypeSettings . barStacked || chartType == Asc . c _oAscChartTypeSettings . barStackedPer ||
chartType == Asc . c _oAscChartTypeSettings . hBarStacked || chartType == Asc . c _oAscChartTypeSettings . hBarStackedPer )
data . push ( { value : Asc . c _oAscChartDataLabelsPos . inBase , displayValue : this . textInnerBottom } ,
{ value : Asc . c _oAscChartDataLabelsPos . inEnd , displayValue : this . textInnerTop } ) ;
else if ( chartType == Asc . c _oAscChartTypeSettings . lineNormal || chartType == Asc . c _oAscChartTypeSettings . lineStacked || chartType == Asc . c _oAscChartTypeSettings . lineStackedPer ||
2021-01-14 09:57:22 +00:00
chartType == Asc . c _oAscChartTypeSettings . lineNormalMarker || chartType == Asc . c _oAscChartTypeSettings . lineStackedMarker || chartType == Asc . c _oAscChartTypeSettings . lineStackedPerMarker ||
chartType == Asc . c _oAscChartTypeSettings . stock || chartType == Asc . c _oAscChartTypeSettings . scatter || chartType == Asc . c _oAscChartTypeSettings . scatterSmoothMarker ||
chartType == Asc . c _oAscChartTypeSettings . scatterSmooth || chartType == Asc . c _oAscChartTypeSettings . scatterLineMarker || chartType == Asc . c _oAscChartTypeSettings . scatterLine )
2016-08-18 11:17:05 +00:00
data . push ( { value : Asc . c _oAscChartDataLabelsPos . l , displayValue : this . textLeft } ,
{ value : Asc . c _oAscChartDataLabelsPos . r , displayValue : this . textRight } ,
{ value : Asc . c _oAscChartDataLabelsPos . t , displayValue : this . textTop } ,
{ value : Asc . c _oAscChartDataLabelsPos . b , displayValue : this . textBottom } ) ;
else if ( chartType == Asc . c _oAscChartTypeSettings . pie || chartType == Asc . c _oAscChartTypeSettings . pie3d )
data . push ( { value : Asc . c _oAscChartDataLabelsPos . bestFit , displayValue : this . textFit } ,
{ value : Asc . c _oAscChartDataLabelsPos . inEnd , displayValue : this . textInnerTop } ,
{ value : Asc . c _oAscChartDataLabelsPos . outEnd , displayValue : this . textOuterTop } ) ;
this . cmbDataLabels . setData ( data ) ;
}
if ( labelPos !== undefined ) {
var rec = this . cmbDataLabels . store . findWhere ( { value : labelPos } ) ;
if ( ! rec )
labelPos = Asc . c _oAscChartDataLabelsPos . ctr ;
} else
labelPos = Asc . c _oAscChartDataLabelsPos . none ;
this . cmbDataLabels . setValue ( labelPos ) ;
this . onSelectDataLabels ( this . cmbDataLabels , { value : labelPos } ) ;
} ,
2020-12-05 20:42:28 +00:00
onVCategoryClick : function ( index ) {
2021-05-04 11:08:26 +00:00
( this . vertAxisProps [ index ] . getAxisType ( ) == Asc . c _oAscAxisType . val ) ? this . fillVProps ( this . vertAxisProps [ index ] , index ) : this . fillHProps ( this . vertAxisProps [ index ] , index , true ) ;
2016-03-11 00:48:53 +00:00
} ,
2020-12-05 20:42:28 +00:00
onHCategoryClick : function ( index ) {
2021-05-04 11:08:26 +00:00
( this . horAxisProps [ index ] . getAxisType ( ) == Asc . c _oAscAxisType . val ) ? this . fillVProps ( this . horAxisProps [ index ] , index , true ) : this . fillHProps ( this . horAxisProps [ index ] , index ) ;
2016-03-11 00:48:53 +00:00
} ,
2021-05-04 11:08:26 +00:00
fillVProps : function ( props , index , hor ) {
2016-04-05 11:52:34 +00:00
if ( props . getAxisType ( ) !== Asc . c _oAscAxisType . val ) return ;
2020-12-05 20:42:28 +00:00
if ( this . _originalAxisVValues == undefined )
this . _originalAxisVValues = [ ] ;
if ( this . _originalAxisVValues [ index ] == undefined ) {
this . _originalAxisVValues [ index ] = {
2016-03-11 00:48:53 +00:00
minAuto : ( props . getMinVal ( ) == null ) ? 0 : props . getMinVal ( ) ,
maxAuto : ( props . getMaxVal ( ) == null ) ? 10 : props . getMaxVal ( ) ,
crossesAuto : ( props . getCrosses ( ) == null ) ? 0 : props . getCrosses ( )
} ;
}
2020-12-05 20:42:28 +00:00
this . chVertHide [ index ] . setValue ( ! props . getShow ( ) ) ;
this . cmbVertGrid [ index ] . setValue ( props . getGridlines ( ) ) ;
2021-05-04 11:08:26 +00:00
this . cmbVertTitle [ index ] . setData ( hor ? this . _arrHorTitle : this . _arrVertTitle ) ;
2020-12-05 20:42:28 +00:00
this . cmbVertTitle [ index ] . setValue ( props . getLabel ( ) ) ;
2016-03-11 00:48:53 +00:00
2020-12-05 20:42:28 +00:00
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 ) ;
2016-03-11 00:48:53 +00:00
value = props . getCrossesRule ( ) ;
2020-12-05 20:42:28 +00:00
this . cmbVCrossType [ index ] . setValue ( value ) ;
2016-03-11 00:48:53 +00:00
switch ( value ) {
2016-04-05 11:52:34 +00:00
case Asc . c _oAscCrossesRule . minValue :
2020-12-05 20:42:28 +00:00
value = this . spnMinValue [ index ] . getNumberValue ( ) ;
2016-03-11 00:48:53 +00:00
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscCrossesRule . maxValue :
2020-12-05 20:42:28 +00:00
value = this . spnMaxValue [ index ] . getNumberValue ( ) ;
2016-03-11 00:48:53 +00:00
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscCrossesRule . auto :
2020-12-05 20:42:28 +00:00
value = this . _originalAxisVValues [ index ] . crossesAuto ;
2016-03-11 00:48:53 +00:00
break ;
default :
value = props . getCrosses ( ) ;
break ;
}
2020-12-05 20:42:28 +00:00
this . spnVAxisCrosses [ index ] . setValue ( ( value == null ) ? '' : value , true ) ;
2016-03-11 00:48:53 +00:00
2020-12-05 20:42:28 +00:00
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 ( ) ) ;
2022-03-09 19:36:47 +00:00
value = props . getLogScale ( ) ;
this . chVLogScale [ index ] . setValue ( ! ! value , true ) ;
this . spnBase [ index ] . setDisabled ( ! value ) ;
value && this . spnBase [ index ] . setValue ( props . getLogBase ( ) , true ) ;
2016-03-11 00:48:53 +00:00
2020-12-05 20:42:28 +00:00
this . currentAxisProps [ index ] = props ;
2016-03-11 00:48:53 +00:00
} ,
2021-05-04 11:08:26 +00:00
fillHProps : function ( props , index , vert ) {
2016-04-05 11:52:34 +00:00
if ( props . getAxisType ( ) !== Asc . c _oAscAxisType . cat ) return ;
2020-12-05 20:42:28 +00:00
if ( this . _originalAxisHValues == undefined )
this . _originalAxisHValues = [ ] ;
if ( this . _originalAxisHValues [ index ] == undefined ) {
this . _originalAxisHValues [ index ] = {
2016-03-11 00:48:53 +00:00
minAuto : ( props . getCrossMinVal ( ) == null ) ? 0 : props . getCrossMinVal ( ) ,
maxAuto : ( props . getCrossMaxVal ( ) == null ) ? 10 : props . getCrossMaxVal ( ) ,
crossesAuto : ( props . getCrosses ( ) == null ) ? 0 : props . getCrosses ( )
} ;
}
2020-12-05 20:42:28 +00:00
this . chHorHide [ index ] . setValue ( ! props . getShow ( ) ) ;
this . cmbHorGrid [ index ] . setValue ( props . getGridlines ( ) ) ;
2021-05-04 11:08:26 +00:00
this . cmbHorTitle [ index ] . setData ( vert ? this . _arrVertTitle : this . _arrHorTitle ) ;
2020-12-05 20:42:28 +00:00
this . cmbHorTitle [ index ] . setValue ( props . getLabel ( ) ) ;
2016-03-11 00:48:53 +00:00
var value = props . getCrossesRule ( ) ;
2020-12-05 20:42:28 +00:00
this . cmbHCrossType [ index ] . setValue ( value ) ;
2016-03-11 00:48:53 +00:00
switch ( value ) {
2016-04-05 11:52:34 +00:00
case Asc . c _oAscCrossesRule . minValue :
2020-12-05 20:42:28 +00:00
value = this . _originalAxisHValues [ index ] . minAuto ;
2016-03-11 00:48:53 +00:00
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscCrossesRule . maxValue :
2020-12-05 20:42:28 +00:00
value = this . _originalAxisHValues [ index ] . maxAuto ;
2016-03-11 00:48:53 +00:00
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscCrossesRule . auto :
2020-12-05 20:42:28 +00:00
value = this . _originalAxisHValues [ index ] . crossesAuto ;
2016-03-11 00:48:53 +00:00
break ;
default :
value = props . getCrosses ( ) ;
break ;
}
2020-12-05 20:42:28 +00:00
this . spnHAxisCrosses [ index ] . setValue ( ( value == null ) ? '' : value , true ) ;
2016-03-11 00:48:53 +00:00
2020-12-05 20:42:28 +00:00
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 ) ;
2016-03-11 00:48:53 +00:00
value = props . getIntervalBetweenLabelsRule ( ) ;
2020-12-05 20:42:28 +00:00
this . cmbLabelInterval [ index ] . setValue ( value ) ;
this . spnLabelInterval [ index ] . setValue ( ( value === Asc . c _oAscBetweenLabelsRule . manual ) ? props . getIntervalBetweenLabels ( ) : 1 , true ) ;
2016-03-11 00:48:53 +00:00
2020-12-05 20:42:28 +00:00
this . currentAxisProps [ index ] = props ;
2016-03-11 00:48:53 +00:00
} ,
2016-09-27 13:20:55 +00:00
updateSparkStyles : function ( styles ) {
2016-09-28 12:21:36 +00:00
if ( styles && styles . length > 1 ) {
var picker = this . cmbSparkStyle . menuPicker ,
stylesStore = picker . store ;
if ( stylesStore . length == styles . length - 1 ) {
var data = stylesStore . models ;
for ( var i = 0 ; i < styles . length - 1 ; i ++ ) {
data [ i ] . set ( 'imageUrl' , styles [ i ] ) ;
}
} else {
2016-09-27 13:20:55 +00:00
var stylearray = [ ] ,
selectedIdx = styles [ styles . length - 1 ] ;
for ( var i = 0 ; i < styles . length - 1 ; i ++ ) {
stylearray . push ( {
imageUrl : styles [ i ] ,
data : i
} ) ;
}
stylesStore . reset ( stylearray , { silent : false } ) ;
2016-09-28 12:21:36 +00:00
this . cmbSparkStyle . fillComboView ( stylesStore . at ( selectedIdx < 0 ? 0 : selectedIdx ) , selectedIdx > - 1 ) ;
2016-09-27 13:20:55 +00:00
}
}
} ,
2016-09-14 13:34:08 +00:00
onSelectSparkType : 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 ;
}
} else {
rawData = record ;
}
2020-05-06 15:04:48 +00:00
this . btnSparkType . setIconCls ( 'svgicon ' + 'chart-' + rawData . iconCls ) ;
2016-10-27 07:35:19 +00:00
if ( this . _changedProps ) {
this . _changedProps . asc _setType ( rawData . type ) ;
}
this . _state . SparkType = rawData . type ;
var changed = false ,
value = this . cmbEmptyCells . getValue ( ) ;
if ( rawData . type !== Asc . c _oAscSparklineType . Line && this . _arrEmptyCells . length > 2 ) {
this . _arrEmptyCells . pop ( ) ;
changed = true ;
} else if ( rawData . type == Asc . c _oAscSparklineType . Line && this . _arrEmptyCells . length < 3 ) {
this . _arrEmptyCells . push ( { value : Asc . c _oAscEDispBlanksAs . Span , displayValue : this . textEmptyLine } ) ;
changed = true ;
}
if ( changed ) {
this . cmbEmptyCells . setData ( this . _arrEmptyCells ) ;
2016-12-05 08:47:45 +00:00
this . cmbEmptyCells . setValue ( ( rawData . type !== Asc . c _oAscSparklineType . Line && value == Asc . c _oAscEDispBlanksAs . Span ) ? this . textEmptyLine : value ) ;
2016-10-27 07:35:19 +00:00
}
2017-07-04 14:13:09 +00:00
this . updateSparkStyles ( this . chartSettings . asc _getStyles ( rawData . type ) ) ;
2016-09-14 13:34:08 +00:00
} ,
2016-09-27 13:20:55 +00:00
2016-10-27 07:35:19 +00:00
onSelectSparkStyle : function ( combo , record ) {
2016-09-27 13:20:55 +00:00
if ( this . _noApply ) return ;
2016-10-27 07:35:19 +00:00
if ( this . _changedProps ) {
this . _changedProps . asc _setStyle ( record . get ( 'data' ) ) ;
}
2016-09-27 13:20:55 +00:00
} ,
2019-10-03 13:56:19 +00:00
2016-03-11 00:48:53 +00:00
_setDefaults : function ( props ) {
var me = this ;
if ( props ) {
this . chartSettings = props ;
2016-09-14 13:34:08 +00:00
if ( this . isChart ) {
this . _state . ChartType = props . getType ( ) ;
2016-03-11 00:48:53 +00:00
2016-09-14 13:34:08 +00:00
this . _noApply = true ;
2016-03-11 00:48:53 +00:00
2016-09-14 13:34:08 +00:00
// Layout
2016-03-11 00:48:53 +00:00
2020-10-09 11:20:31 +00:00
if ( this . isDiagramMode ) {
var record = this . mnuChartTypePicker . store . findWhere ( { type : this . _state . ChartType } ) ;
this . mnuChartTypePicker . selectRecord ( record , true ) ;
if ( record ) {
this . btnChartType . setIconCls ( 'svgicon ' + 'chart-' + record . get ( 'iconCls' ) ) ;
} else
this . btnChartType . setIconCls ( 'svgicon' ) ;
}
2016-03-11 00:48:53 +00:00
2016-09-14 13:34:08 +00:00
this . _noApply = false ;
2016-03-11 00:48:53 +00:00
2016-09-14 13:34:08 +00:00
this . cmbChartTitle . setValue ( props . getTitle ( ) ) ;
this . cmbLegendPos . setValue ( props . getLegendPos ( ) ) ;
2016-03-11 00:48:53 +00:00
2016-09-14 13:34:08 +00:00
this . updateDataLabels ( this . _state . ChartType , props . getDataLabelsPos ( ) ) ;
2021-06-18 11:33:57 +00:00
this . cmbDataLabels . setDisabled ( this . _state . ChartType == Asc . c _oAscChartTypeSettings . surfaceNormal ||
this . _state . ChartType == Asc . c _oAscChartTypeSettings . surfaceWireframe ) ;
2016-03-11 00:48:53 +00:00
2016-09-14 13:34:08 +00:00
this . chSeriesName . setValue ( this . chartSettings . getShowSerName ( ) , true ) ;
this . chCategoryName . setValue ( this . chartSettings . getShowCatName ( ) , true ) ;
this . chValue . setValue ( this . chartSettings . getShowVal ( ) , true ) ;
2016-03-11 00:48:53 +00:00
2020-07-08 13:07:57 +00:00
var value = props . getSeparator ( ) ;
2016-09-14 13:34:08 +00:00
this . txtSeparator . setValue ( ( value ) ? value : '' ) ;
2016-03-11 00:48:53 +00:00
2016-09-14 13:34:08 +00:00
// Vertical Axis
2020-12-05 20:42:28 +00:00
this . vertAxisProps = props . getVertAxesProps ( ) ;
2016-03-11 00:48:53 +00:00
2016-09-14 13:34:08 +00:00
// Horizontal Axis
2020-12-05 20:42:28 +00:00
this . horAxisProps = props . getHorAxesProps ( ) ;
2016-03-11 00:48:53 +00:00
2016-09-14 13:34:08 +00:00
this . updateAxisProps ( this . _state . ChartType ) ;
this . currentChartType = this . _state . ChartType ;
2017-01-18 19:26:05 +00:00
if ( this . imageSettings ) {
value = this . imageSettings . asc _getTitle ( ) ;
this . inputAltTitle . setValue ( value ? value : '' ) ;
value = this . imageSettings . asc _getDescription ( ) ;
this . textareaAltDescription . val ( value ? value : '' ) ;
2019-10-03 13:56:19 +00:00
value = this . imageSettings . asc _getAnchor ( ) ;
switch ( value ) {
case AscCommon . c _oAscCellAnchorType . cellanchorTwoCell :
this . radioTwoCell . setValue ( true , true ) ;
break ;
case AscCommon . c _oAscCellAnchorType . cellanchorOneCell :
this . radioOneCell . setValue ( true , true ) ;
break ;
case AscCommon . c _oAscCellAnchorType . cellanchorAbsolute :
this . radioAbsolute . setValue ( true , true ) ;
break ;
}
2017-01-18 19:26:05 +00:00
}
2016-09-14 13:34:08 +00:00
} else { // sparkline
2016-09-20 11:46:36 +00:00
this . _state . SparkType = props . asc _getType ( ) ;
var record = this . mnuSparkTypePicker . store . findWhere ( { type : this . _state . SparkType } ) ;
this . mnuSparkTypePicker . selectRecord ( record , true ) ;
if ( record )
2020-05-06 15:04:48 +00:00
this . btnSparkType . setIconCls ( 'svgicon ' + 'chart-' + record . get ( 'iconCls' ) ) ;
2017-06-28 13:12:57 +00:00
else
2020-05-06 15:04:48 +00:00
this . btnSparkType . setIconCls ( 'svgicon' ) ;
2016-09-27 13:20:55 +00:00
2017-04-11 11:05:56 +00:00
this . updateSparkStyles ( ( this . sparklineStyles ) ? this . sparklineStyles : props . asc _getStyles ( ) ) ;
2016-09-20 11:46:36 +00:00
if ( this . _state . SparkType !== Asc . c _oAscSparklineType . Line )
this . _arrEmptyCells . pop ( ) ;
this . cmbEmptyCells . setData ( this . _arrEmptyCells ) ;
2016-12-05 08:47:45 +00:00
var value = props . asc _getDisplayEmpty ( ) ;
this . cmbEmptyCells . setValue ( ( this . _state . SparkType !== Asc . c _oAscSparklineType . Line && value == Asc . c _oAscEDispBlanksAs . Span ) ? this . textEmptyLine : value ) ;
2016-09-20 11:46:36 +00:00
this . chShowEmpty . setValue ( props . asc _getDisplayHidden ( ) , true ) ;
this . chShowAxis . setValue ( props . asc _getDisplayXAxis ( ) , true ) ;
this . chReverse . setValue ( props . asc _getRightToLeft ( ) , true ) ;
this . cmbSparkMinType . setValue ( props . asc _getMinAxisType ( ) , true ) ;
this . cmbSparkMaxType . setValue ( props . asc _getMaxAxisType ( ) , true ) ;
this . spnSparkMinValue . setDisabled ( props . asc _getMinAxisType ( ) !== Asc . c _oAscSparklineAxisMinMax . Custom ) ;
this . spnSparkMaxValue . setDisabled ( props . asc _getMaxAxisType ( ) !== Asc . c _oAscSparklineAxisMinMax . Custom ) ;
2016-10-27 07:35:19 +00:00
this . spnSparkMinValue . setValue ( ( props . asc _getManualMin ( ) !== null ) ? props . asc _getManualMin ( ) : '' , true ) ;
this . spnSparkMaxValue . setValue ( ( props . asc _getManualMax ( ) !== null ) ? props . asc _getManualMax ( ) : '' , true ) ;
2017-04-11 11:05:56 +00:00
/ *
2016-11-30 14:08:26 +00:00
var value = props . asc _getDataRanges ( ) ;
if ( value && value . length == 2 ) {
this . txtSparkDataRange . setValue ( ( value [ 0 ] ) ? value [ 0 ] : '' ) ;
this . txtSparkDataLocation . setValue ( ( value [ 1 ] ) ? value [ 1 ] : '' ) ;
2016-12-13 12:54:58 +00:00
this . sparkDataRangeValid = value [ 0 ] ;
this . txtSparkDataRange . validation = function ( value ) {
if ( _ . isEmpty ( value ) )
return true ;
var isvalid = me . api . asc _checkDataRange ( Asc . c _oAscSelectionDialogType . Chart , value , false ) ;
return ( isvalid == Asc . c _oAscError . ID . DataRangeError ) ? me . textInvalidRange : true ;
} ;
this . dataLocationRangeValid = value [ 1 ] ;
this . txtSparkDataLocation . validation = function ( value ) {
if ( _ . isEmpty ( value ) )
return true ;
var isvalid = me . api . asc _checkDataRange ( Asc . c _oAscSelectionDialogType . FormatTable , value , false ) ;
return ( isvalid == Asc . c _oAscError . ID . DataRangeError ) ? me . textInvalidRange : true ;
} ;
2016-11-30 14:08:26 +00:00
}
2017-04-11 11:05:56 +00:00
* /
2016-11-30 14:08:26 +00:00
2016-10-27 07:35:19 +00:00
this . _changedProps = new Asc . sparklineGroup ( ) ;
this . _noApply = false ;
2016-09-14 13:34:08 +00:00
}
2016-03-11 00:48:53 +00:00
}
} ,
getSettings : function ( ) {
2017-06-28 13:12:57 +00:00
var value ;
2016-03-11 00:48:53 +00:00
2016-10-27 07:35:19 +00:00
if ( this . isChart ) {
2020-08-19 16:54:02 +00:00
var type = this . currentChartType ;
2020-10-09 11:20:31 +00:00
if ( this . isDiagramMode ) {
var rec = this . mnuChartTypePicker . getSelectedRec ( ) ;
rec && ( type = rec . get ( 'type' ) ) ;
}
2017-06-28 13:12:57 +00:00
2016-10-27 07:35:19 +00:00
this . chartSettings . putType ( type ) ;
2016-03-11 00:48:53 +00:00
2020-07-08 13:07:57 +00:00
// this.chartSettings.putInColumns(this.cmbDataDirect.getValue()==1);
// this.chartSettings.putRange(this.txtDataRange.getValue());
2016-03-11 00:48:53 +00:00
2016-10-27 07:35:19 +00:00
this . chartSettings . putTitle ( this . cmbChartTitle . getValue ( ) ) ;
this . chartSettings . putLegendPos ( this . cmbLegendPos . getValue ( ) ) ;
2016-03-11 00:48:53 +00:00
2016-10-27 07:35:19 +00:00
this . chartSettings . putDataLabelsPos ( this . cmbDataLabels . getValue ( ) ) ;
2016-03-11 00:48:53 +00:00
2016-10-27 07:35:19 +00:00
this . chartSettings . putShowSerName ( this . chSeriesName . getValue ( ) == 'checked' ) ;
this . chartSettings . putShowCatName ( this . chCategoryName . getValue ( ) == 'checked' ) ;
this . chartSettings . putShowVal ( this . chValue . getValue ( ) == 'checked' ) ;
2016-03-11 00:48:53 +00:00
2016-10-27 07:35:19 +00:00
this . chartSettings . putSeparator ( _ . isEmpty ( this . txtSeparator . getValue ( ) ) ? ' ' : this . txtSeparator . getValue ( ) ) ;
2016-03-11 00:48:53 +00:00
2016-10-27 07:35:19 +00:00
this . chartSettings . putShowMarker ( this . chMarkers . getValue ( ) == 'checked' ) ;
2016-03-11 00:48:53 +00:00
2016-10-27 07:35:19 +00:00
value = ( type == Asc . c _oAscChartTypeSettings . lineNormal || type == Asc . c _oAscChartTypeSettings . lineStacked ||
2021-01-14 09:57:22 +00:00
type == Asc . c _oAscChartTypeSettings . lineStackedPer || type == Asc . c _oAscChartTypeSettings . lineNormalMarker ||
type == Asc . c _oAscChartTypeSettings . lineStackedMarker || type == Asc . c _oAscChartTypeSettings . lineStackedPerMarker ||
type == Asc . c _oAscChartTypeSettings . scatter || type == Asc . c _oAscChartTypeSettings . scatterSmoothMarker || type == Asc . c _oAscChartTypeSettings . scatterSmooth ||
type == Asc . c _oAscChartTypeSettings . scatterLineMarker || type == Asc . c _oAscChartTypeSettings . scatterLine ) ;
2016-10-27 07:35:19 +00:00
if ( value ) {
value = this . cmbLines . getValue ( ) ;
this . chartSettings . putLine ( value !== 0 ) ;
if ( value > 0 )
this . chartSettings . putSmooth ( value == 2 ) ;
}
2016-03-11 00:48:53 +00:00
2020-12-05 20:42:28 +00:00
// this.chartSettings.putVertAxisProps(this.vertAxisProps);
// this.chartSettings.putHorAxisProps(this.horAxisProps);
2016-03-11 00:48:53 +00:00
2019-10-03 13:56:19 +00:00
if ( ( this . isAltTitleChanged || this . isAltDescChanged ) && ! this . _changedImageProps )
this . _changedImageProps = new Asc . asc _CImgProperty ( ) ;
2017-01-18 19:26:05 +00:00
if ( this . isAltTitleChanged )
2019-10-03 13:56:19 +00:00
this . _changedImageProps . asc _putTitle ( this . inputAltTitle . getValue ( ) ) ;
2017-01-18 19:26:05 +00:00
if ( this . isAltDescChanged )
2019-10-03 13:56:19 +00:00
this . _changedImageProps . asc _putDescription ( this . textareaAltDescription . val ( ) ) ;
2017-01-18 19:26:05 +00:00
2019-10-03 13:56:19 +00:00
return { chartSettings : this . chartSettings , imageSettings : this . _changedImageProps } ;
2016-10-27 07:35:19 +00:00
} else {
return { chartSettings : this . _changedProps } ;
}
2016-03-11 00:48:53 +00:00
} ,
2019-10-03 13:56:19 +00:00
onRadioSnapChange : function ( field , newValue , eOpts ) {
if ( newValue ) {
if ( ! this . _changedImageProps )
this . _changedImageProps = new Asc . asc _CImgProperty ( ) ;
this . _changedImageProps . asc _putAnchor ( field . options . value ) ;
}
} ,
2016-03-11 00:48:53 +00:00
isRangeValid : function ( ) {
2020-07-15 10:21:32 +00:00
if ( this . isChart ) {
var isvalid ,
range = this . chartSettings . getRange ( ) ;
if ( ! _ . isEmpty ( range ) ) {
2020-08-19 16:54:02 +00:00
var type = this . currentChartType ;
2020-10-09 11:20:31 +00:00
if ( this . isDiagramMode ) {
var rec = this . mnuChartTypePicker . getSelectedRec ( ) ;
rec && ( type = rec . get ( 'type' ) ) ;
}
2021-02-20 13:54:09 +00:00
isvalid = this . api . asc _checkDataRange ( Asc . c _oAscSelectionDialogType . Chart , range , true , this . chartSettings . getInRows ( ) , type ) ;
2020-07-15 10:21:32 +00:00
if ( isvalid == Asc . c _oAscError . ID . No )
return true ;
} else
return true ;
this . setActiveCategory ( 0 ) ;
if ( isvalid == Asc . c _oAscError . ID . StockChartError ) {
Common . UI . warning ( { msg : this . errorStockChart } ) ;
} else if ( isvalid == Asc . c _oAscError . ID . MaxDataSeriesError ) {
Common . UI . warning ( { msg : this . errorMaxRows } ) ;
} else if ( isvalid == Asc . c _oAscError . ID . MaxDataPointsError )
Common . UI . warning ( { msg : this . errorMaxPoints } ) ;
return false ;
} else
return true ;
2016-03-11 00:48:53 +00:00
} ,
2020-07-08 13:07:57 +00:00
// onSelectData: function() {
// var me = this;
// if (me.api) {
// me.btnChartType.menu.options.additionalAlign = me.menuAddAlign;
// me.btnSparkType.menu.options.additionalAlign = me.menuAddAlign;
//
// var handlerDlg = function(dlg, result) {
// if (result == 'ok') {
// me.dataRangeValid = dlg.getSettings();
// me.txtDataRange.setValue(me.dataRangeValid);
// me.txtDataRange.checkValidate();
// }
// };
//
// var win = new SSE.Views.CellRangeDialog({
// handler: handlerDlg
// }).on('close', function() {
// me.show();
// });
//
// var xy = me.$window.offset();
// me.hide();
// win.show(xy.left + 160, xy.top + 125);
// win.setSettings({
// api : me.api,
// isRows : (me.cmbDataDirect.getValue()==0),
// range : (!_.isEmpty(me.txtDataRange.getValue()) && (me.txtDataRange.checkValidate()==true)) ? me.txtDataRange.getValue() : me.dataRangeValid,
// type : Asc.c_oAscSelectionDialogType.Chart
// });
// }
// },
2016-03-11 00:48:53 +00:00
onSelectDataLabels : function ( obj , rec , e ) {
2016-04-05 11:52:34 +00:00
var disable = rec . value == Asc . c _oAscChartDataLabelsPos . none ;
2016-03-11 00:48:53 +00:00
this . chSeriesName . setDisabled ( disable ) ;
this . chCategoryName . setDisabled ( disable ) ;
this . chValue . setDisabled ( disable ) ;
this . txtSeparator . setDisabled ( disable ) ;
if ( ! disable && this . chSeriesName . getValue ( ) !== 'checked' && this . chCategoryName . getValue ( ) !== 'checked'
&& this . chValue . getValue ( ) !== 'checked' ) {
this . chValue . setValue ( 'checked' , true ) ;
}
} ,
2016-12-13 12:54:58 +00:00
onSelectSparkData : function ( ) {
var me = this ;
if ( me . api ) {
var handlerDlg = function ( dlg , result ) {
if ( result == 'ok' ) {
me . sparkDataRangeValid = dlg . getSettings ( ) ;
me . txtSparkDataRange . setValue ( me . sparkDataRangeValid ) ;
me . txtSparkDataRange . checkValidate ( ) ;
}
} ;
var win = new SSE . Views . CellRangeDialog ( {
handler : handlerDlg
} ) . on ( 'close' , function ( ) {
me . show ( ) ;
} ) ;
var xy = me . $window . offset ( ) ;
me . hide ( ) ;
win . show ( xy . left + 160 , xy . top + 125 ) ;
win . setSettings ( {
api : me . api ,
range : ( ! _ . isEmpty ( me . txtSparkDataRange . getValue ( ) ) && ( me . txtSparkDataRange . checkValidate ( ) == true ) ) ? me . txtSparkDataRange . getValue ( ) : me . sparkDataRangeValid ,
type : Asc . c _oAscSelectionDialogType . Chart
} ) ;
}
} ,
onSelectLocationData : function ( ) {
var me = this ;
if ( me . api ) {
var handlerDlg = function ( dlg , result ) {
if ( result == 'ok' ) {
me . dataLocationRangeValid = dlg . getSettings ( ) ;
me . txtSparkDataLocation . setValue ( me . dataLocationRangeValid ) ;
me . txtSparkDataLocation . checkValidate ( ) ;
}
} ;
var win = new SSE . Views . CellRangeDialog ( {
handler : handlerDlg
} ) . on ( 'close' , function ( ) {
me . show ( ) ;
} ) ;
var xy = me . $window . offset ( ) ;
me . hide ( ) ;
win . show ( xy . left + 160 , xy . top + 125 ) ;
win . setSettings ( {
api : me . api ,
range : ( ! _ . isEmpty ( me . txtSparkDataLocation . getValue ( ) ) && ( me . txtSparkDataLocation . checkValidate ( ) == true ) ) ? me . txtSparkDataLocation . getValue ( ) : me . dataLocationRangeValid ,
type : Asc . c _oAscSelectionDialogType . FormatTable
} ) ;
}
} ,
2020-12-07 19:20:22 +00:00
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 ,
2020-12-08 09:09:16 +00:00
props : { format : fmt . getFormatCode ( ) , formatInfo : fmt . getFormatCellsInfo ( ) , langId : value , chartFormat : fmt }
2020-12-07 19:20:22 +00:00
} ) ) . on ( 'close' , function ( ) {
me . _isEditFormat && me . chartSettings . cancelEditData ( ) ;
me . _isEditFormat = false ;
} ) ;
me . _isEditFormat = true ;
me . chartSettings . startEditData ( ) ;
win . show ( ) ;
2020-12-07 13:22:18 +00:00
} ,
2020-07-06 17:01:11 +00:00
show : function ( ) {
2016-03-11 00:48:53 +00:00
Common . Views . AdvancedSettingsWindow . prototype . show . apply ( this , arguments ) ;
2020-07-08 13:07:57 +00:00
// var me = this;
// _.delay(function(){
// me.txtDataRange.cmpEl.find('input').focus();
// },50);
2016-03-11 00:48:53 +00:00
} ,
close : function ( ) {
this . api . asc _onCloseChartFrame ( ) ;
Common . Views . AdvancedSettingsWindow . prototype . close . apply ( this , arguments ) ;
} ,
textTitle : 'Chart - Advanced Settings' ,
textShowValues : 'Display chart values' ,
textShowBorders : 'Display chart borders' ,
textDataRows : 'in rows' ,
textDataColumns : 'in columns' ,
textDisplayLegend : 'Display Legend' ,
textLegendBottom : 'Bottom' ,
textLegendTop : 'Top' ,
textLegendRight : 'Right' ,
textLegendLeft : 'Left' ,
textChartTitle : 'Chart Title' ,
textXAxisTitle : 'X Axis Title' ,
textYAxisTitle : 'Y Axis Title' ,
txtEmpty : 'This field is required' ,
textInvalidRange : 'ERROR! Invalid cells range' ,
2020-06-05 17:34:50 +00:00
textChartElementsLegend : 'Chart Elements &<br>Chart Legend' ,
2016-03-11 00:48:53 +00:00
textLayout : 'Layout' ,
textLegendPos : 'Legend' ,
textDataLabels : 'Data Labels' ,
textSeparator : 'Data Labels Separator' ,
textSeriesName : 'Series Name' ,
textCategoryName : 'Category Name' ,
textValue : 'Value' ,
textAxisOptions : 'Axis Options' ,
textMinValue : 'Minimum Value' ,
textMaxValue : 'Maximum Value' ,
textAxisCrosses : 'Axis Crosses' ,
textUnits : 'Display Units' ,
textTickOptions : 'Tick Options' ,
textMajorType : 'Major Type' ,
textMinorType : 'Minor Type' ,
textLabelOptions : 'Label Options' ,
textLabelPos : 'Label Position' ,
textReverse : 'Values in reverse order' ,
textVertAxis : 'Vertical Axis' ,
textHorAxis : 'Horizontal Axis' ,
textMarksInterval : 'Interval between Marks' ,
textLabelDist : 'Axis Label Distance' ,
textLabelInterval : 'Interval between Labels' ,
textAxisPos : 'Axis Position' ,
textLeftOverlay : 'Left Overlay' ,
textRightOverlay : 'Right Overlay' ,
textOverlay : 'Overlay' ,
textNoOverlay : 'No Overlay' ,
textRotated : 'Rotated' ,
textHorizontal : 'Horizontal' ,
textInnerBottom : 'Inner Bottom' ,
textInnerTop : 'Inner Top' ,
textOuterTop : 'Outer Top' ,
textNone : 'None' ,
textCenter : 'Center' ,
textFixed : 'Fixed' ,
textAuto : 'Auto' ,
textCross : 'Cross' ,
textIn : 'In' ,
textOut : 'Out' ,
textLow : 'Low' ,
textHigh : 'High' ,
textNextToAxis : 'Next to axis' ,
textHundreds : 'Hundreds' ,
textThousands : 'Thousands' ,
textTenThousands : '10 000' ,
textHundredThousands : '100 000' ,
textMillions : 'Millions' ,
textTenMillions : '10 000 000' ,
textHundredMil : '100 000 000' ,
textBillions : 'Billions' ,
textTrillions : 'Trillions' ,
textCustom : 'Custom' ,
textManual : 'Manual' ,
textBetweenTickMarks : 'Between Tick Marks' ,
textOnTickMarks : 'On Tick Marks' ,
textLines : 'Lines' ,
textMarkers : 'Markers' ,
textMajor : 'Major' ,
textMinor : 'Minor' ,
textMajorMinor : 'Major and Minor' ,
textStraight : 'Straight' ,
textSmooth : 'Smooth' ,
textType : 'Type' ,
textTypeData : 'Type & Data' ,
textStyle : 'Style' ,
2020-04-06 14:57:55 +00:00
textSelectData : 'Select data' ,
2016-03-11 00:48:53 +00:00
errorMaxRows : 'ERROR! The maximum number of data series per chart is 255.' ,
errorStockChart : 'Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price.' ,
textAxisSettings : 'Axis Settings' ,
textGridLines : 'Gridlines' ,
textShow : 'Show' ,
2016-08-18 11:17:05 +00:00
textHide : 'Hide' ,
textLeft : 'Left' ,
textRight : 'Right' ,
textTop : 'Top' ,
textBottom : 'Bottom' ,
2016-09-14 13:34:08 +00:00
textFit : 'Fit Width' ,
textSparkRanges : 'Sparkline Ranges' ,
textLocationRange : 'Location Range' ,
textEmptyCells : 'Hidden and Empty cells' ,
textShowEmptyCells : 'Show empty cells as' ,
textShowData : 'Show data in hidden rows and columns' ,
textGroup : 'Group Sparkline' ,
textSingle : 'Single Sparkline' ,
textGaps : 'Gaps' ,
textZero : 'Zero' ,
textEmptyLine : 'Connect data points with line' ,
textShowSparkAxis : 'Show Axis' ,
textReverseOrder : 'Reverse order' ,
textAutoEach : 'Auto for Each' ,
textSameAll : 'Same for All' ,
2017-01-18 19:26:05 +00:00
textTitleSparkline : 'Sparkline - Advanced Settings' ,
textAlt : 'Alternative Text' ,
textAltTitle : 'Title' ,
textAltDescription : 'Description' ,
2017-07-05 12:22:02 +00:00
textAltTip : 'The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table.' ,
2019-10-03 13:56:19 +00:00
errorMaxPoints : 'ERROR! The maximum number of points in series per chart is 4096.' ,
textSnap : 'Cell Snapping' ,
textAbsolute : 'Don\'t move or size with cells' ,
textOneCell : 'Move but don\'t size with cells' ,
2020-12-05 20:42:28 +00:00
textTwoCell : 'Move and size with cells' ,
textVertAxisSec : 'Secondary Vertical Axis' ,
textHorAxisSec : 'Secondary Horizontal Axis' ,
textAxisTitle : 'Title' ,
2020-12-07 13:22:18 +00:00
textHideAxis : 'Hide axis' ,
2022-03-09 19:36:47 +00:00
textFormat : 'Label format' ,
textBase : 'Base' ,
textLogScale : 'Logarithmic Scale'
2017-01-18 19:26:05 +00:00
} , SSE . Views . ChartSettingsDlg || { } ) ) ;
2016-03-11 00:48:53 +00:00
} ) ;