@@ -14,16 +14,11 @@ class DrillDown extends React.Component {
1414 this . state = {
1515 selectedChild : 0 ,
1616 showDrillDown : false ,
17- dataSource : this . props . dataSource , // Parent Chat's Data Source
18- mappedIds : this . props . mappedIds , // An array of indices which maps each
19- // data plot of parent with its nested Chart Component.
20- chartConfig : { // Parent Chart Config.
21- type : 'column2d' ,
22- width : 600 ,
23- height : 400 ,
24- dataFormat : 'json' ,
25- dataSource : this . props . dataSource ,
26- } ,
17+ // Parent Chat's Data Source
18+ dataSource : this . props . dataSource ,
19+ // An array of indices which maps each
20+ // data plot of parent with its nested Chart Component.
21+ mappedIds : this . props . mappedIds ,
2722 borderColor : ( this . props . overlayBtn && this . props . overlayBtn . borderColor ) ? this . props . overlayBtn . borderColor : '#000' ,
2823 backgroundColor : ( this . props . overlayBtn && this . props . overlayBtn . backgroundColor ) ? this . props . overlayBtn . backgroundColor : '#F6F6F6' ,
2924 color : ( this . props . overlayBtn && this . props . overlayBtn . color ) ? this . props . overlayBtn . color : '#000' ,
@@ -37,14 +32,18 @@ class DrillDown extends React.Component {
3732 plotClicked ( e ) {
3833 //Index of the data plot that is clicked.
3934 let index = e . data . index ;
35+ if ( index <= this . state . mappedIds . length ) {
36+ console . log ( 'OUT OF BOUND' ) ;
37+ return ;
38+ }
4039 //Index of Drilled Down Chart.
4140 let plotPosition = this . state . mappedIds [ index ] ;
4241
4342 if ( ! this . state . showDrillDown && plotPosition >= 0 ) {
4443 this . setState ( {
4544 showDrillDown : true ,
4645 selectedChild : plotPosition
47- } )
46+ } ) ;
4847 }
4948 }
5049
@@ -64,17 +63,23 @@ class DrillDown extends React.Component {
6463 cursor : 'pointer' ,
6564 } ;
6665
66+ console . log ( btnStyle ) ;
67+
6768 return (
6869 < div style = { {
6970 position : 'relative' ,
7071 } } >
71- { this . state . showDrillDown ?
72- < div style = { { position : 'relative' } } >
73- < span style = { btnStyle }
72+ { this . state . showDrillDown ?
73+ < div style = { { position : 'relative' } } >
74+ < span style = { btnStyle }
7475 onClick = { ( ) => this . setState ( { showDrillDown : false } ) } >
75- { this . props . overlayBtn && this . props . overlayBtn . message ? this . props . overlayBtn . message : 'Revert' }
76+ {
77+ this . props . overlayBtn && this . props . overlayBtn . message ?
78+ this . props . overlayBtn . message : 'Revert'
79+ }
7680 </ span >
77- { this . props . children [ this . state . selectedChild ] } { /* Displaying Correct Drilled Down Chart. */ }
81+ { /* Displaying Correct Drilled Down Chart. */ }
82+ { this . props . children [ this . state . selectedChild ] }
7883 </ div > :
7984 < ReactFC
8085 type = { this . props . type }
0 commit comments