2016-04-01 13:17:09 +00:00
/ *
*
* ( c ) Copyright Ascensio System Limited 2010 - 2016
*
* 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 Lubanas st . 125 a - 25 , Riga , Latvia ,
* EU , LV - 1021.
*
* 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
* Copyright ( c ) 2014 Ascensio System SIA . All rights reserved .
*
* /
define ( [ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' ,
'common/main/lib/view/AdvancedSettingsWindow' ,
'common/main/lib/component/CheckBox' ,
'common/main/lib/component/InputField' ,
'spreadsheeteditor/main/app/view/CellRangeDialog'
] , function ( contentTemplate ) {
'use strict' ;
SSE . Views . ChartSettingsDlg = Common . Views . AdvancedSettingsWindow . extend ( _ . extend ( {
options : {
contentWidth : 322 ,
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 : [
{ panelId : 'id-chart-settings-dlg-style' , panelCaption : this . textTypeData } ,
{ 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 }
] ,
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-04-05 11:52:34 +00:00
ChartType : Asc . c _oAscChartTypeSettings . barNormal
2016-03-11 00:48:53 +00:00
} ;
this . _noApply = true ;
this . api = this . options . api ;
this . chartSettings = this . options . chartSettings ;
this . vertAxisProps = null ;
this . horAxisProps = null ;
this . currentAxisProps = null ;
this . dataRangeValid = '' ;
2016-08-18 11:17:05 +00:00
this . currentChartType = this . _state . ChartType ;
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
var menuAddAlign = function ( menuRoot , left , top ) {
var self = this ;
if ( ! $window . hasClass ( 'notransform' ) ) {
$window . addClass ( 'notransform' ) ;
menuRoot . addClass ( 'hidden' ) ;
setTimeout ( function ( ) {
menuRoot . removeClass ( 'hidden' ) ;
menuRoot . css ( { left : left , top : top } ) ;
self . options . additionalAlign = null ;
} , 500 ) ;
} else {
menuRoot . css ( { left : left , top : top } ) ;
self . options . additionalAlign = null ;
}
} ;
this . btnChartType = new Common . UI . Button ( {
cls : 'btn-large-dataview' ,
iconCls : 'item-chartlist bar-normal' ,
menu : new Common . UI . Menu ( {
style : 'width: 560px;' ,
additionalAlign : menuAddAlign ,
items : [
{ template : _ . template ( '<div id="id-chart-dlg-menu-type" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>' ) }
]
} )
} ) ;
this . btnChartType . on ( 'render:after' , function ( btn ) {
me . mnuChartTypePicker = new Common . UI . DataView ( {
el : $ ( '#id-chart-dlg-menu-type' ) ,
parentMenu : btn . menu ,
restoreHeight : 411 ,
groups : new Common . UI . DataViewGroupStore ( [
{ id : 'menu-chart-group-bar' , caption : me . textColumn } ,
{ id : 'menu-chart-group-line' , caption : me . textLine } ,
{ id : 'menu-chart-group-pie' , caption : me . textPie } ,
{ id : 'menu-chart-group-hbar' , caption : me . textBar } ,
{ id : 'menu-chart-group-area' , caption : me . textArea } ,
{ id : 'menu-chart-group-scatter' , caption : me . textPoint } ,
{ id : 'menu-chart-group-stock' , caption : me . textStock }
] ) ,
store : new Common . UI . DataViewStore ( [
2016-04-05 11:52:34 +00:00
{ group : 'menu-chart-group-bar' , type : Asc . c _oAscChartTypeSettings . barNormal , iconCls : 'column-normal' , selected : true } ,
{ group : 'menu-chart-group-bar' , type : Asc . c _oAscChartTypeSettings . barStacked , iconCls : 'column-stack' } ,
{ group : 'menu-chart-group-bar' , type : Asc . c _oAscChartTypeSettings . barStackedPer , iconCls : 'column-pstack' } ,
{ group : 'menu-chart-group-bar' , type : Asc . c _oAscChartTypeSettings . barNormal3d , iconCls : 'column-3d-normal' } ,
{ group : 'menu-chart-group-bar' , type : Asc . c _oAscChartTypeSettings . barStacked3d , iconCls : 'column-3d-stack' } ,
{ group : 'menu-chart-group-bar' , type : Asc . c _oAscChartTypeSettings . barStackedPer3d , iconCls : 'column-3d-pstack' } ,
{ group : 'menu-chart-group-bar' , type : Asc . c _oAscChartTypeSettings . barNormal3dPerspective , iconCls : 'column-3d-normal-per' } ,
{ group : 'menu-chart-group-line' , type : Asc . c _oAscChartTypeSettings . lineNormal , iconCls : 'line-normal' } ,
{ group : 'menu-chart-group-line' , type : Asc . c _oAscChartTypeSettings . lineStacked , iconCls : 'line-stack' } ,
{ group : 'menu-chart-group-line' , type : Asc . c _oAscChartTypeSettings . lineStackedPer , iconCls : 'line-pstack' } ,
{ group : 'menu-chart-group-line' , type : Asc . c _oAscChartTypeSettings . line3d , iconCls : 'line-3d' } ,
{ group : 'menu-chart-group-pie' , type : Asc . c _oAscChartTypeSettings . pie , iconCls : 'pie-normal' } ,
{ group : 'menu-chart-group-pie' , type : Asc . c _oAscChartTypeSettings . doughnut , iconCls : 'pie-doughnut' } ,
{ group : 'menu-chart-group-pie' , type : Asc . c _oAscChartTypeSettings . pie3d , iconCls : 'pie-3d-normal' } ,
{ group : 'menu-chart-group-hbar' , type : Asc . c _oAscChartTypeSettings . hBarNormal , iconCls : 'bar-normal' } ,
{ group : 'menu-chart-group-hbar' , type : Asc . c _oAscChartTypeSettings . hBarStacked , iconCls : 'bar-stack' } ,
{ group : 'menu-chart-group-hbar' , type : Asc . c _oAscChartTypeSettings . hBarStackedPer , iconCls : 'bar-pstack' } ,
{ group : 'menu-chart-group-hbar' , type : Asc . c _oAscChartTypeSettings . hBarNormal3d , iconCls : 'bar-3d-normal' } ,
{ group : 'menu-chart-group-hbar' , type : Asc . c _oAscChartTypeSettings . hBarStacked3d , iconCls : 'bar-3d-stack' } ,
{ group : 'menu-chart-group-hbar' , type : Asc . c _oAscChartTypeSettings . hBarStackedPer3d , iconCls : 'bar-3d-pstack' } ,
{ group : 'menu-chart-group-area' , type : Asc . c _oAscChartTypeSettings . areaNormal , iconCls : 'area-normal' } ,
{ group : 'menu-chart-group-area' , type : Asc . c _oAscChartTypeSettings . areaStacked , iconCls : 'area-stack' } ,
{ group : 'menu-chart-group-area' , type : Asc . c _oAscChartTypeSettings . areaStackedPer , iconCls : 'area-pstack' } ,
{ group : 'menu-chart-group-scatter' , type : Asc . c _oAscChartTypeSettings . scatter , iconCls : 'point-normal' } ,
{ group : 'menu-chart-group-stock' , type : Asc . c _oAscChartTypeSettings . stock , iconCls : 'stock-normal' }
2016-03-11 00:48:53 +00:00
] ) ,
itemTemplate : _ . template ( '<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>' )
} ) ;
} ) ;
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 . InputField ( {
el : $ ( '#chart-dlg-txt-range' ) ,
name : 'range' ,
style : 'width: 100%;' ,
allowBlank : true ,
blankError : this . txtEmpty ,
validateOnChange : true
} ) ;
this . btnSelectData = new Common . UI . Button ( {
el : $ ( '#chart-dlg-btn-data' )
} ) ;
this . btnSelectData . on ( '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 : [
2016-04-05 11:52:34 +00:00
{ value : Asc . c _oAscChartTitleShowSettings . none , displayValue : this . textNone } ,
{ value : Asc . c _oAscChartTitleShowSettings . overlay , displayValue : this . textOverlay } ,
{ value : Asc . c _oAscChartTitleShowSettings . noOverlay , displayValue : this . textNoOverlay }
2016-03-11 00:48:53 +00:00
]
} ) ;
this . cmbLegendPos = new Common . UI . ComboBox ( {
el : $ ( '#chart-dlg-combo-legend-pos' ) ,
menuStyle : 'min-width: 140px;' ,
editable : false ,
cls : 'input-group-nr' ,
data : [
2016-04-05 11:52:34 +00:00
{ 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 }
2016-03-11 00:48:53 +00:00
]
} ) ;
this . cmbHorTitle = new Common . UI . ComboBox ( {
el : $ ( '#chart-dlg-combo-hor-title' ) ,
menuStyle : 'min-width: 140px;' ,
editable : false ,
cls : 'input-group-nr' ,
data : [
2016-04-05 11:52:34 +00:00
{ value : Asc . c _oAscChartHorAxisLabelShowSettings . none , displayValue : this . textNone } ,
{ value : Asc . c _oAscChartHorAxisLabelShowSettings . noOverlay , displayValue : this . textNoOverlay }
2016-03-11 00:48:53 +00:00
]
} ) . 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 : [
2016-04-05 11:52:34 +00:00
{ value : Asc . c _oAscChartVertAxisLabelShowSettings . none , displayValue : this . textNone } ,
{ value : Asc . c _oAscChartVertAxisLabelShowSettings . rotated , displayValue : this . textRotated } ,
{ value : Asc . c _oAscChartVertAxisLabelShowSettings . horizontal , displayValue : this . textHorizontal }
2016-03-11 00:48:53 +00:00
]
} ) . 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 : [
2016-04-05 11:52:34 +00:00
{ 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 }
2016-03-11 00:48:53 +00:00
]
} ) . 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 : [
2016-04-05 11:52:34 +00:00
{ 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 }
2016-03-11 00:48:53 +00:00
]
} ) . 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 : [
2016-04-05 11:52:34 +00:00
{ 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 }
2016-03-11 00:48:53 +00:00
]
} ) ;
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 : [
2016-04-05 11:52:34 +00:00
{ displayValue : this . textAuto , value : Asc . c _oAscValAxisRule . auto } ,
{ displayValue : this . textFixed , value : Asc . c _oAscValAxisRule . fixed }
2016-03-11 00:48:53 +00:00
]
} ) . on ( 'selected' , _ . bind ( function ( combo , record ) {
if ( this . currentAxisProps ) {
this . currentAxisProps . putMinValRule ( record . value ) ;
2016-04-05 11:52:34 +00:00
if ( record . value == Asc . c _oAscValAxisRule . auto ) {
2016-03-11 00:48:53 +00:00
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 ( ) ;
2016-04-05 11:52:34 +00:00
this . cmbMinType . setValue ( Asc . c _oAscValAxisRule . fixed ) ;
2016-03-11 00:48:53 +00:00
this . cmbMinType . resumeEvents ( ) ;
if ( this . currentAxisProps ) {
2016-04-05 11:52:34 +00:00
this . currentAxisProps . putMinValRule ( Asc . c _oAscValAxisRule . fixed ) ;
2016-03-11 00:48:53 +00:00
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 : [
2016-04-05 11:52:34 +00:00
{ displayValue : this . textAuto , value : Asc . c _oAscValAxisRule . auto } ,
{ displayValue : this . textFixed , value : Asc . c _oAscValAxisRule . fixed }
2016-03-11 00:48:53 +00:00
]
} ) . on ( 'selected' , _ . bind ( function ( combo , record ) {
if ( this . currentAxisProps ) {
this . currentAxisProps . putMaxValRule ( record . value ) ;
2016-04-05 11:52:34 +00:00
if ( record . value == Asc . c _oAscValAxisRule . auto ) {
2016-03-11 00:48:53 +00:00
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 ( ) ;
2016-04-05 11:52:34 +00:00
this . cmbMaxType . setValue ( Asc . c _oAscValAxisRule . fixed ) ;
2016-03-11 00:48:53 +00:00
this . cmbMaxType . resumeEvents ( ) ;
if ( this . currentAxisProps ) {
2016-04-05 11:52:34 +00:00
this . currentAxisProps . putMaxValRule ( Asc . c _oAscValAxisRule . fixed ) ;
2016-03-11 00:48:53 +00:00
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 : [
2016-04-05 11:52:34 +00:00
{ 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 }
2016-03-11 00:48:53 +00:00
]
} ) . on ( 'selected' , _ . bind ( function ( combo , record ) {
if ( this . currentAxisProps ) {
this . currentAxisProps . putCrossesRule ( record . value ) ;
var value ;
switch ( record . value ) {
2016-04-05 11:52:34 +00:00
case Asc . c _oAscCrossesRule . minValue :
2016-03-11 00:48:53 +00:00
this . spnVAxisCrosses . setValue ( this . spnMinValue . getNumberValue ( ) , true ) ;
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscCrossesRule . maxValue :
2016-03-11 00:48:53 +00:00
this . spnVAxisCrosses . setValue ( this . spnMaxValue . getNumberValue ( ) , true ) ;
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscCrossesRule . auto :
2016-03-11 00:48:53 +00:00
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 ( ) ;
2016-04-05 11:52:34 +00:00
this . cmbVCrossType . setValue ( Asc . c _oAscCrossesRule . value ) ;
2016-03-11 00:48:53 +00:00
this . cmbVCrossType . resumeEvents ( ) ;
if ( this . currentAxisProps ) {
2016-04-05 11:52:34 +00:00
this . currentAxisProps . putCrossesRule ( Asc . c _oAscCrossesRule . value ) ;
2016-03-11 00:48:53 +00:00
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 : [
2016-04-05 11:52:34 +00:00
{ 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 }
2016-03-11 00:48:53 +00:00
]
} ) . 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 : [
2016-04-05 11:52:34 +00:00
{ 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 }
2016-03-11 00:48:53 +00:00
]
} ) . 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 : [
2016-04-05 11:52:34 +00:00
{ 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 }
2016-03-11 00:48:53 +00:00
]
} ) . 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 : [
2016-04-05 11:52:34 +00:00
{ 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 }
2016-03-11 00:48:53 +00:00
]
} ) . 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 : [
2016-04-05 11:52:34 +00:00
{ 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 }
2016-03-11 00:48:53 +00:00
]
} ) . on ( 'selected' , _ . bind ( function ( combo , record ) {
if ( this . currentAxisProps ) {
this . currentAxisProps . putCrossesRule ( record . value ) ;
2016-04-05 11:52:34 +00:00
if ( record . value == Asc . c _oAscCrossesRule . auto ) {
2016-03-11 00:48:53 +00:00
this . spnHAxisCrosses . setValue ( this . _originalAxisHValues . crossesAuto , true ) ;
2016-04-05 11:52:34 +00:00
} else if ( record . value == Asc . c _oAscCrossesRule . minValue ) {
2016-03-11 00:48:53 +00:00
this . spnHAxisCrosses . setValue ( this . _originalAxisHValues . minAuto , true ) ;
2016-04-05 11:52:34 +00:00
} else if ( record . value == Asc . c _oAscCrossesRule . maxValue ) {
2016-03-11 00:48:53 +00:00
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 ( ) ;
2016-04-05 11:52:34 +00:00
this . cmbHCrossType . setValue ( Asc . c _oAscCrossesRule . value ) ;
2016-03-11 00:48:53 +00:00
this . cmbHCrossType . resumeEvents ( ) ;
if ( this . currentAxisProps ) {
2016-04-05 11:52:34 +00:00
this . currentAxisProps . putCrossesRule ( Asc . c _oAscCrossesRule . value ) ;
2016-03-11 00:48:53 +00:00
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 : [
2016-04-05 11:52:34 +00:00
{ displayValue : this . textOnTickMarks , value : Asc . c _oAscLabelsPosition . byDivisions } ,
{ displayValue : this . textBetweenTickMarks , value : Asc . c _oAscLabelsPosition . betweenDivisions }
2016-03-11 00:48:53 +00:00
]
} ) . 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 : [
2016-04-05 11:52:34 +00:00
{ 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 }
2016-03-11 00:48:53 +00:00
]
} ) . 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 : [
2016-04-05 11:52:34 +00:00
{ 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 }
2016-03-11 00:48:53 +00:00
]
} ) . 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 : [
2016-04-05 11:52:34 +00:00
{ 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 }
2016-03-11 00:48:53 +00:00
]
} ) . 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 ( ) ;
2016-04-05 11:52:34 +00:00
this . cmbLabelInterval . setValue ( Asc . c _oAscBetweenLabelsRule . manual ) ;
2016-03-11 00:48:53 +00:00
this . cmbLabelInterval . resumeEvents ( ) ;
if ( this . currentAxisProps ) {
2016-04-05 11:52:34 +00:00
this . currentAxisProps . putIntervalBetweenLabelsRule ( Asc . c _oAscBetweenLabelsRule . manual ) ;
2016-03-11 00:48:53 +00:00
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 : [
2016-04-05 11:52:34 +00:00
{ displayValue : this . textAuto , value : Asc . c _oAscBetweenLabelsRule . auto } ,
{ displayValue : this . textManual , value : Asc . c _oAscBetweenLabelsRule . manual }
2016-03-11 00:48:53 +00:00
]
} ) . on ( 'selected' , _ . bind ( function ( combo , record ) {
if ( this . currentAxisProps ) {
this . currentAxisProps . putIntervalBetweenLabelsRule ( record . value ) ;
2016-04-05 11:52:34 +00:00
if ( record . value == Asc . c _oAscBetweenLabelsRule . auto )
2016-03-11 00:48:53 +00:00
this . spnLabelInterval . setValue ( 1 , true ) ;
}
} , this ) ) ;
this . btnsCategory [ 2 ] . on ( 'click' , _ . bind ( this . onVCategoryClick , this ) ) ;
this . btnsCategory [ 3 ] . on ( 'click' , _ . bind ( this . onHCategoryClick , this ) ) ;
this . afterRender ( ) ;
} ,
afterRender : function ( ) {
this . _setDefaults ( this . chartSettings ) ;
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 ( ) ;
if ( value == 2 ) this . onVCategoryClick ( ) ;
else if ( value == 3 ) this . onHCategoryClick ( ) ;
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 ;
}
this . btnChartType . setIconCls ( 'item-chartlist ' + rawData . iconCls ) ;
this . chartSettings . changeType ( rawData . type ) ;
this . updateAxisProps ( rawData . type , true ) ;
this . vertAxisProps = this . chartSettings . getVertAxisProps ( ) ;
this . horAxisProps = this . chartSettings . getHorAxisProps ( ) ;
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 ||
type == Asc . c _oAscChartTypeSettings . lineStackedPer || type == Asc . c _oAscChartTypeSettings . scatter ) ;
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 ) ;
2016-03-11 00:48:53 +00:00
this . btnsCategory [ 2 ] . setDisabled ( value ) ;
this . btnsCategory [ 3 ] . setDisabled ( value ) ;
this . cmbHorShow . setDisabled ( value ) ;
this . cmbVertShow . setDisabled ( value ) ;
this . cmbHorTitle . setDisabled ( value ) ;
this . cmbVertTitle . setDisabled ( value ) ;
this . cmbHorGrid . setDisabled ( value ) ;
this . cmbVertGrid . setDisabled ( value ) ;
this . cmbHorShow . setValue ( this . chartSettings . getShowHorAxis ( ) ) ;
this . cmbVertShow . setValue ( this . chartSettings . getShowVerAxis ( ) ) ;
this . cmbHorTitle . setValue ( this . chartSettings . getHorAxisLabel ( ) ) ;
this . cmbVertTitle . setValue ( this . chartSettings . getVertAxisLabel ( ) ) ;
this . cmbHorGrid . setValue ( this . chartSettings . getHorGridLines ( ) ) ;
this . cmbVertGrid . setValue ( this . chartSettings . getVertGridLines ( ) ) ;
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 ) ;
this . cmbAxisPos . setDisabled ( value ) ;
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 ) ;
2016-03-11 00:48:53 +00:00
this . btnsCategory [ 2 ] . options . contentTarget = ( value ) ? 'id-chart-settings-dlg-hor' : 'id-chart-settings-dlg-vert' ;
2016-04-05 11:52:34 +00:00
this . btnsCategory [ 3 ] . options . contentTarget = ( value || type == Asc . c _oAscChartTypeSettings . scatter ) ? '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 ||
chartType == Asc . c _oAscChartTypeSettings . stock || chartType == Asc . c _oAscChartTypeSettings . scatter )
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 } ) ;
} ,
2016-03-11 00:48:53 +00:00
onVCategoryClick : function ( ) {
2016-04-05 11:52:34 +00:00
( this . vertAxisProps . getAxisType ( ) == Asc . c _oAscAxisType . val ) ? this . fillVProps ( this . vertAxisProps ) : this . fillHProps ( this . vertAxisProps ) ;
2016-03-11 00:48:53 +00:00
} ,
onHCategoryClick : function ( ) {
2016-04-05 11:52:34 +00:00
( this . horAxisProps . getAxisType ( ) == Asc . c _oAscAxisType . val ) ? this . fillVProps ( this . horAxisProps ) : this . fillHProps ( this . horAxisProps ) ;
2016-03-11 00:48:53 +00:00
} ,
fillVProps : function ( props ) {
2016-04-05 11:52:34 +00:00
if ( props . getAxisType ( ) !== Asc . c _oAscAxisType . val ) return ;
2016-03-11 00:48:53 +00:00
if ( this . _originalAxisVValues == undefined ) {
this . _originalAxisVValues = {
minAuto : ( props . getMinVal ( ) == null ) ? 0 : props . getMinVal ( ) ,
maxAuto : ( props . getMaxVal ( ) == null ) ? 10 : props . getMaxVal ( ) ,
crossesAuto : ( props . getCrosses ( ) == null ) ? 0 : props . getCrosses ( )
} ;
}
this . cmbMinType . setValue ( props . getMinValRule ( ) ) ;
2016-04-05 11:52:34 +00:00
var value = ( props . getMinValRule ( ) == Asc . c _oAscValAxisRule . auto ) ? this . _originalAxisVValues . minAuto : props . getMinVal ( ) ;
2016-03-11 00:48:53 +00:00
this . spnMinValue . setValue ( ( value == null ) ? '' : value , true ) ;
this . cmbMaxType . setValue ( props . getMaxValRule ( ) ) ;
2016-04-05 11:52:34 +00:00
value = ( props . getMaxValRule ( ) == Asc . c _oAscValAxisRule . auto ) ? this . _originalAxisVValues . maxAuto : props . getMaxVal ( ) ;
2016-03-11 00:48:53 +00:00
this . spnMaxValue . setValue ( ( value == null ) ? '' : value , true ) ;
value = props . getCrossesRule ( ) ;
this . cmbVCrossType . setValue ( value ) ;
switch ( value ) {
2016-04-05 11:52:34 +00:00
case Asc . c _oAscCrossesRule . minValue :
2016-03-11 00:48:53 +00:00
value = this . spnMinValue . getNumberValue ( ) ;
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscCrossesRule . maxValue :
2016-03-11 00:48:53 +00:00
value = this . spnMaxValue . getNumberValue ( ) ;
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscCrossesRule . auto :
2016-03-11 00:48:53 +00:00
value = this . _originalAxisVValues . crossesAuto ;
break ;
default :
value = props . getCrosses ( ) ;
break ;
}
this . spnVAxisCrosses . setValue ( ( value == null ) ? '' : value , true ) ;
this . cmbUnits . setValue ( props . getDispUnitsRule ( ) ) ;
this . chVReverse . setValue ( props . getInvertValOrder ( ) , true ) ;
this . cmbVMajorType . setValue ( props . getMajorTickMark ( ) ) ;
this . cmbVMinorType . setValue ( props . getMinorTickMark ( ) ) ;
this . cmbVLabelPos . setValue ( props . getTickLabelsPos ( ) ) ;
this . currentAxisProps = props ;
} ,
fillHProps : function ( props ) {
2016-04-05 11:52:34 +00:00
if ( props . getAxisType ( ) !== Asc . c _oAscAxisType . cat ) return ;
2016-03-11 00:48:53 +00:00
if ( this . _originalAxisHValues == undefined ) {
this . _originalAxisHValues = {
minAuto : ( props . getCrossMinVal ( ) == null ) ? 0 : props . getCrossMinVal ( ) ,
maxAuto : ( props . getCrossMaxVal ( ) == null ) ? 10 : props . getCrossMaxVal ( ) ,
crossesAuto : ( props . getCrosses ( ) == null ) ? 0 : props . getCrosses ( )
} ;
}
var value = props . getCrossesRule ( ) ;
this . cmbHCrossType . setValue ( value ) ;
switch ( value ) {
2016-04-05 11:52:34 +00:00
case Asc . c _oAscCrossesRule . minValue :
2016-03-11 00:48:53 +00:00
value = this . _originalAxisHValues . minAuto ;
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscCrossesRule . maxValue :
2016-03-11 00:48:53 +00:00
value = this . _originalAxisHValues . maxAuto ;
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscCrossesRule . auto :
2016-03-11 00:48:53 +00:00
value = this . _originalAxisHValues . crossesAuto ;
break ;
default :
value = props . getCrosses ( ) ;
break ;
}
this . spnHAxisCrosses . setValue ( ( value == null ) ? '' : value , true ) ;
this . cmbAxisPos . setValue ( props . getLabelsPosition ( ) ) ;
this . chHReverse . setValue ( props . getInvertCatOrder ( ) , true ) ;
this . cmbHMajorType . setValue ( props . getMajorTickMark ( ) ) ;
this . cmbHMinorType . setValue ( props . getMinorTickMark ( ) ) ;
this . spnMarksInterval . setValue ( props . getIntervalBetweenTick ( ) , true ) ;
this . cmbHLabelPos . setValue ( props . getTickLabelsPos ( ) ) ;
this . spnLabelDist . setValue ( props . getLabelsAxisDistance ( ) , true ) ;
value = props . getIntervalBetweenLabelsRule ( ) ;
this . cmbLabelInterval . setValue ( value ) ;
2016-04-05 11:52:34 +00:00
this . spnLabelInterval . setValue ( ( value === Asc . c _oAscBetweenLabelsRule . manual ) ? props . getIntervalBetweenLabels ( ) : 1 , true ) ;
2016-03-11 00:48:53 +00:00
this . currentAxisProps = props ;
} ,
_setDefaults : function ( props ) {
var me = this ;
if ( props ) {
this . chartSettings = props ;
this . _state . ChartType = props . getType ( ) ;
this . _noApply = true ;
// Layout
var record = this . mnuChartTypePicker . store . findWhere ( { type : this . _state . ChartType } ) ;
this . mnuChartTypePicker . selectRecord ( record , true ) ;
if ( record ) {
this . btnChartType . setIconCls ( 'item-chartlist ' + record . get ( 'iconCls' ) ) ;
}
this . _noApply = false ;
var value = props . getRange ( ) ;
this . txtDataRange . setValue ( ( value ) ? value : '' ) ;
this . dataRangeValid = value ;
this . txtDataRange . validation = function ( value ) {
if ( _ . isEmpty ( value ) ) {
if ( ! me . cmbDataDirect . isDisabled ( ) ) me . cmbDataDirect . setDisabled ( true ) ;
return true ;
}
if ( me . cmbDataDirect . isDisabled ( ) ) me . cmbDataDirect . setDisabled ( false ) ;
2016-04-05 11:52:34 +00:00
var isvalid = me . api . asc _checkDataRange ( Asc . c _oAscSelectionDialogType . Chart , value , false ) ;
return ( isvalid == Asc . c _oAscError . ID . DataRangeError ) ? me . textInvalidRange : true ;
2016-03-11 00:48:53 +00:00
} ;
this . cmbDataDirect . setDisabled ( value === null ) ;
this . cmbDataDirect . setValue ( props . getInColumns ( ) ? 1 : 0 ) ;
this . cmbChartTitle . setValue ( props . getTitle ( ) ) ;
this . cmbLegendPos . setValue ( props . getLegendPos ( ) ) ;
2016-08-18 11:17:05 +00:00
this . updateDataLabels ( this . _state . ChartType , props . getDataLabelsPos ( ) ) ;
2016-03-11 00:48:53 +00:00
this . chSeriesName . setValue ( this . chartSettings . getShowSerName ( ) , true ) ;
this . chCategoryName . setValue ( this . chartSettings . getShowCatName ( ) , true ) ;
this . chValue . setValue ( this . chartSettings . getShowVal ( ) , true ) ;
value = props . getSeparator ( ) ;
this . txtSeparator . setValue ( ( value ) ? value : '' ) ;
// Vertical Axis
this . vertAxisProps = props . getVertAxisProps ( ) ;
// Horizontal Axis
this . horAxisProps = props . getHorAxisProps ( ) ;
this . updateAxisProps ( this . _state . ChartType ) ;
2016-08-18 11:17:05 +00:00
this . currentChartType = this . _state . ChartType ;
2016-03-11 00:48:53 +00:00
}
} ,
getSettings : function ( ) {
var value ,
type = this . mnuChartTypePicker . getSelectedRec ( ) [ 0 ] . get ( 'type' ) ;
// Layout
this . chartSettings . putType ( type ) ;
this . chartSettings . putInColumns ( this . cmbDataDirect . getValue ( ) == 1 ) ;
this . chartSettings . putRange ( this . txtDataRange . getValue ( ) ) ;
this . chartSettings . putTitle ( this . cmbChartTitle . getValue ( ) ) ;
this . chartSettings . putLegendPos ( this . cmbLegendPos . getValue ( ) ) ;
this . chartSettings . putShowHorAxis ( this . cmbHorShow . getValue ( ) ) ;
this . chartSettings . putShowVerAxis ( this . cmbVertShow . getValue ( ) ) ;
this . chartSettings . putHorAxisLabel ( this . cmbHorTitle . getValue ( ) ) ;
this . chartSettings . putVertAxisLabel ( this . cmbVertTitle . getValue ( ) ) ;
this . chartSettings . putHorGridLines ( this . cmbHorGrid . getValue ( ) ) ;
this . chartSettings . putVertGridLines ( this . cmbVertGrid . getValue ( ) ) ;
this . chartSettings . putDataLabelsPos ( this . cmbDataLabels . getValue ( ) ) ;
this . chartSettings . putShowSerName ( this . chSeriesName . getValue ( ) == 'checked' ) ;
this . chartSettings . putShowCatName ( this . chCategoryName . getValue ( ) == 'checked' ) ;
this . chartSettings . putShowVal ( this . chValue . getValue ( ) == 'checked' ) ;
this . chartSettings . putSeparator ( _ . isEmpty ( this . txtSeparator . getValue ( ) ) ? ' ' : this . txtSeparator . getValue ( ) ) ;
this . chartSettings . putShowMarker ( this . chMarkers . getValue ( ) == 'checked' ) ;
2016-04-05 11:52:34 +00:00
value = ( type == Asc . c _oAscChartTypeSettings . lineNormal || type == Asc . c _oAscChartTypeSettings . lineStacked ||
type == Asc . c _oAscChartTypeSettings . lineStackedPer || type == Asc . c _oAscChartTypeSettings . scatter ) ;
2016-03-11 00:48:53 +00:00
if ( value ) {
value = this . cmbLines . getValue ( ) ;
this . chartSettings . putLine ( value !== 0 ) ;
if ( value > 0 )
this . chartSettings . putSmooth ( value == 2 ) ;
}
this . chartSettings . putVertAxisProps ( this . vertAxisProps ) ;
this . chartSettings . putHorAxisProps ( this . horAxisProps ) ;
return { chartSettings : this . chartSettings } ;
} ,
isRangeValid : function ( ) {
var isvalid ;
if ( ! _ . isEmpty ( this . txtDataRange . getValue ( ) ) ) {
2016-04-05 11:52:34 +00:00
isvalid = this . api . asc _checkDataRange ( Asc . c _oAscSelectionDialogType . Chart , this . txtDataRange . getValue ( ) , true , this . cmbDataDirect . getValue ( ) == 0 , this . mnuChartTypePicker . getSelectedRec ( ) [ 0 ] . get ( 'type' ) ) ;
if ( isvalid == Asc . c _oAscError . ID . No )
2016-03-11 00:48:53 +00:00
return true ;
} else
this . txtDataRange . showError ( [ this . txtEmpty ] ) ;
2016-04-21 11:47:28 +00:00
this . setActiveCategory ( 0 ) ;
2016-04-05 11:52:34 +00:00
if ( isvalid == Asc . c _oAscError . ID . StockChartError ) {
2016-03-11 00:48:53 +00:00
Common . UI . warning ( { msg : this . errorStockChart } ) ;
2016-04-05 11:52:34 +00:00
} else if ( isvalid == Asc . c _oAscError . ID . MaxDataSeriesError ) {
2016-03-11 00:48:53 +00:00
Common . UI . warning ( { msg : this . errorMaxRows } ) ;
} else
this . txtDataRange . cmpEl . find ( 'input' ) . focus ( ) ;
return false ;
} ,
onSelectData : function ( ) {
var me = this ;
if ( me . api ) {
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
} ) ;
}
} ,
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 ) ;
}
} ,
show : function ( ) {
Common . Views . AdvancedSettingsWindow . prototype . show . apply ( this , arguments ) ;
var me = this ;
_ . delay ( function ( ) {
me . txtDataRange . cmpEl . find ( 'input' ) . focus ( ) ;
} , 50 ) ;
} ,
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' ,
textLine : 'Line' ,
textColumn : 'Column' ,
textBar : 'Bar' ,
textArea : 'Area' ,
textPie : 'Pie' ,
textPoint : 'Point' ,
textStock : 'Stock' ,
textDataRows : 'in rows' ,
textDataColumns : 'in columns' ,
textDisplayLegend : 'Display Legend' ,
textLegendBottom : 'Bottom' ,
textLegendTop : 'Top' ,
textLegendRight : 'Right' ,
textLegendLeft : 'Left' ,
textShowAxis : 'Display Axis' ,
textShowGrid : 'Grid Lines' ,
textDataRange : 'Data Range' ,
textChartTitle : 'Chart Title' ,
textXAxisTitle : 'X Axis Title' ,
textYAxisTitle : 'Y Axis Title' ,
txtEmpty : 'This field is required' ,
textInvalidRange : 'ERROR! Invalid cells range' ,
cancelButtonText : 'Cancel' ,
textTypeStyle : 'Chart Type, Style &<br/>Data Range' ,
textChartElementsLegend : 'Chart Elements &<br/>Chart Legend' ,
textLayout : 'Layout' ,
textLegendPos : 'Legend' ,
textHorTitle : 'Horizontal Axis Title' ,
textVertTitle : 'Vertical Axis Title' ,
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' ,
textHorGrid : 'Horizontal Gridlines' ,
textVertGrid : 'Vertical Gridlines' ,
textLines : 'Lines' ,
textMarkers : 'Markers' ,
textMajor : 'Major' ,
textMinor : 'Minor' ,
textMajorMinor : 'Major and Minor' ,
textStraight : 'Straight' ,
textSmooth : 'Smooth' ,
textType : 'Type' ,
textTypeData : 'Type & Data' ,
textStyle : 'Style' ,
textSelectData : 'Select Data' ,
textDataSeries : 'Data series' ,
errorMaxRows : 'ERROR! The maximum number of data series per chart is 255.' ,
errorStockChart : 'Incorrect row order. To build a stock chart place the data on the sheet in the following order:<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' ,
textFit : 'Fit Width'
2016-03-11 00:48:53 +00:00
} , SSE . Views . ChartSettingsDlg || { } ) ) ;
} ) ;