@@ -13,25 +13,27 @@ class DrillDown extends React.Component {
1313 super ( props ) ;
1414
1515 this . state = {
16+ showDefaultOverlayBtn : ( this . props . showDefaultOverlayBtn === null ) ? true : this . props . showDefaultOverlayBtn ,
1617 showOverlaybtn : true ,
1718 overlayZindex : 1 ,
1819 // Absolute position of Overlay Button
19- positionH : ( this . props . overlayBtn && this . props . overlayBtn . placement && this . props . overlayBtn . placement . includes ( '-' ) ) ? this . props . overlayBtn . placement . split ( '-' ) [ 1 ] : 'right' ,
20- positionV : ( this . props . overlayBtn && this . props . overlayBtn . placement && this . props . overlayBtn . placement . includes ( '-' ) ) ? this . props . overlayBtn . placement . split ( '-' ) [ 0 ] : 'top' ,
20+ positionH : ( this . props . defaultOverlayBtnSettings && this . props . defaultOverlayBtnSettings . placement && this . props . defaultOverlayBtnSettings . placement . includes ( '-' ) ) ? this . props . defaultOverlayBtnSettings . placement . split ( '-' ) [ 1 ] : 'right' ,
21+ positionV : ( this . props . defaultOverlayBtnSettings && this . props . defaultOverlayBtnSettings . placement && this . props . defaultOverlayBtnSettings . placement . includes ( '-' ) ) ? this . props . defaultOverlayBtnSettings . placement . split ( '-' ) [ 0 ] : 'top' ,
2122 selectedChild : 0 ,
2223 showDrillDown : false ,
2324 // Parent Chart's Data Source
2425 dataSource : this . props . dataSource ,
2526 // An array of indices which maps each
2627 // data plot of parent with its nested Chart Component.
2728 mappedIds : this . props . mappedIds ,
28- borderColor : ( this . props . overlayBtn && this . props . overlayBtn . borderColor ) ? this . props . overlayBtn . borderColor : '#000' ,
29- backgroundColor : ( this . props . overlayBtn && this . props . overlayBtn . backgroundColor ) ? this . props . overlayBtn . backgroundColor : '#F6F6F6' ,
30- color : ( this . props . overlayBtn && this . props . overlayBtn . color ) ? this . props . overlayBtn . color : '#000' ,
31- fontSize : ( this . props . overlayBtn && this . props . overlayBtn . fontSize ) ? this . props . overlayBtn . fontSize : '14px' ,
32- padding : ( this . props . overlayBtn && this . props . overlayBtn . padding ) ? this . props . overlayBtn . padding : '3px' ,
33- fontWeight : ( this . props . fontWeight && this . props . overlayBtn . fontWeight ) ? this . props . overlayBtn . fontWeight : 'bold' ,
34- margin : ( this . props . overlayBtn && this . props . overlayBtn . margin ) ? this . props . overlayBtn . margin : '10px'
29+ borderColor : ( this . props . defaultOverlayBtnSettings && this . props . defaultOverlayBtnSettings . borderColor ) ? this . props . defaultOverlayBtnSettings . borderColor : '#000' ,
30+ backgroundColor : ( this . props . defaultOverlayBtnSettings && this . props . defaultOverlayBtnSettings . backgroundColor ) ? this . props . defaultOverlayBtnSettings . backgroundColor : '#F6F6F6' ,
31+ color : ( this . props . defaultOverlayBtnSettings && this . props . defaultOverlayBtnSettings . color ) ? this . props . defaultOverlayBtnSettings . color : '#000' ,
32+ fontSize : ( this . props . defaultOverlayBtnSettings && this . props . defaultOverlayBtnSettings . fontSize ) ? this . props . defaultOverlayBtnSettings . fontSize : '14px' ,
33+ padding : ( this . props . defaultOverlayBtnSettings && this . props . defaultOverlayBtnSettings . padding ) ? this . props . defaultOverlayBtnSettings . padding : '3px' ,
34+ fontWeight : ( this . props . fontWeight && this . props . defaultOverlayBtnSettings . fontWeight ) ? this . props . defaultOverlayBtnSettings . fontWeight : 'bold' ,
35+ margin : ( this . props . defaultOverlayBtnSettings && this . props . defaultOverlayBtnSettings . margin ) ? this . props . defaultOverlayBtnSettings . margin : '10px' ,
36+ fontFamily : ( this . props . defaultOverlayBtnSettings && this . props . defaultOverlayBtnSettings . fontFamily ) ? this . props . defaultOverlayBtnSettings . fontFamily : 'Verdana, sans' ,
3537 } ;
3638 }
3739
@@ -70,30 +72,50 @@ class DrillDown extends React.Component {
7072 }
7173 }
7274
75+ // Checks whether our current Chart has a parent whose Overlay Button an be hidden.
7376 renderComplete ( ) {
7477 if ( this . props && this . props . toggleParentOverlayBtnVisibility ) {
7578 this . props . toggleParentOverlayBtnVisibility ( false ) ;
7679 }
7780 }
7881
82+ // Toggles the visibilty of the Overlay Button
7983 toggleParentOverlayBtnVisibility ( visibility ) {
80- this . setState ( { showOverlaybtn : visibility } ) ;
84+ this . setState ( { showOverlaybtn : visibility } ) ;
8185 }
8286
87+ // Handles click of the Overlay Button
8388 onClickOverlayBtn ( ) {
8489 this . setState ( { showDrillDown : false } ) ;
8590 if ( this . props && this . props . toggleParentOverlayBtnVisibility && this . state . showDrillDown ) {
8691 this . props . toggleParentOverlayBtnVisibility ( true ) ;
8792 }
8893 }
8994
95+ // Configurable events for linked charts
96+ beforeLinkedItemOpen ( ) {
97+
98+ }
99+
100+ linkedItemOpened ( ) {
101+
102+ }
103+
104+ beforeLinkedItemClosed ( ) {
105+
106+ }
107+
108+ linkedItemClosed ( ) {
109+
110+ }
111+
90112 render ( ) {
91- // In-line style for overlay button
113+ // In-line style for default overlay button
92114 const btnStyle = {
93115 border : `1px solid ${ this . state . borderColor } ` ,
94116 backgroundColor : `${ this . state . backgroundColor } ` ,
95117 color : `${ this . state . color } ` ,
96- fontFamily : 'Verdana, sans' ,
118+ fontFamily : ` ${ this . state . fontFamily } ` ,
97119 fontSize : `${ this . state . fontSize } ` ,
98120 padding : `${ this . state . padding } ` ,
99121 fontWeight : `${ this . state . fontWeight } ` ,
@@ -122,18 +144,23 @@ class DrillDown extends React.Component {
122144 width : this . props . width ,
123145 height : this . props . height ,
124146 onRender : this . renderComplete . bind ( this ) ,
125- // overlayBtn: this.props.overlayBtn,
126147 toggleParentOverlayBtnVisibility : this . toggleParentOverlayBtnVisibility . bind ( this )
127148 }
128149 ) }
129150 { this . state . showOverlaybtn ?
130- < span style = { btnStyle }
151+ < button style = {
152+ this . state . showDefaultOverlayBtn ?
153+ btnStyle : (
154+ this . props . customOverlayBtnStyle ?
155+ { cursor : 'pointer' , ...this . props . customOverlayBtnStyle } : btnStyle
156+ )
157+ }
131158 onClick = { this . onClickOverlayBtn . bind ( this ) } >
132159 {
133- this . props . overlayBtn && this . props . overlayBtn . message ?
134- this . props . overlayBtn . message : 'Back'
160+ this . props . defaultOverlayBtnSettings && this . props . defaultOverlayBtnSettings . message ?
161+ this . props . defaultOverlayBtnSettings . message : 'Back'
135162 }
136- </ span > : null
163+ </ button > : null
137164 }
138165 </ div >
139166 ) ;
0 commit comments