@@ -15,6 +15,7 @@ import { ResizableBox } from 'react-resizable';
15
15
import styles from './Databrowser.scss' ;
16
16
17
17
import AggregationPanel from '../../../components/AggregationPanel/AggregationPanel' ;
18
+ import ChartVisualization from '../../../components/ChartVisualization/ChartVisualization.react' ;
18
19
19
20
/**
20
21
* DataBrowser renders the browser toolbar and data table
@@ -49,6 +50,8 @@ export default class DataBrowser extends React.Component {
49
50
isResizing : false ,
50
51
maxWidth : window . innerWidth - 300 ,
51
52
showAggregatedData : true ,
53
+ isChartPanelVisible : false ,
54
+ chartPanelWidth : 400 ,
52
55
} ;
53
56
54
57
this . handleResizeDiv = this . handleResizeDiv . bind ( this ) ;
@@ -67,6 +70,7 @@ export default class DataBrowser extends React.Component {
67
70
this . setSelectedObjectId = this . setSelectedObjectId . bind ( this ) ;
68
71
this . setContextMenu = this . setContextMenu . bind ( this ) ;
69
72
this . handleCellClick = this . handleCellClick . bind ( this ) ;
73
+ this . toggleChartPanelVisibility = this . toggleChartPanelVisibility . bind ( this ) ;
70
74
this . saveOrderTimeout = null ;
71
75
}
72
76
@@ -210,6 +214,12 @@ export default class DataBrowser extends React.Component {
210
214
}
211
215
}
212
216
217
+ toggleChartPanelVisibility ( ) {
218
+ this . setState ( prevState => ( {
219
+ isChartPanelVisible : ! prevState . isChartPanelVisible
220
+ } ) ) ;
221
+ }
222
+
213
223
getAllClassesSchema ( schema ) {
214
224
const allClasses = Object . keys ( schema . data . get ( 'classes' ) . toObject ( ) ) ;
215
225
const schemaSimplifiedData = { } ;
@@ -610,9 +620,7 @@ export default class DataBrowser extends React.Component {
610
620
firstSelectedCell : clickedCellKey ,
611
621
} ) ;
612
622
}
613
- }
614
-
615
- render ( ) {
623
+ } render ( ) {
616
624
const {
617
625
className,
618
626
count,
@@ -682,6 +690,31 @@ export default class DataBrowser extends React.Component {
682
690
</ div >
683
691
</ ResizableBox >
684
692
) }
693
+ { this . state . isChartPanelVisible && this . state . selectedData . length > 1 && (
694
+ < ResizableBox
695
+ width = { this . state . chartPanelWidth }
696
+ height = { Infinity }
697
+ minConstraints = { [ 400 , Infinity ] }
698
+ maxConstraints = { [ 800 , Infinity ] }
699
+ onResizeStart = { ( ) => this . setState ( { isResizing : true } ) }
700
+ onResizeStop = { ( event , { size } ) => this . setState ( {
701
+ isResizing : false ,
702
+ chartPanelWidth : size . width
703
+ } ) }
704
+ onResize = { ( event , { size } ) => this . setState ( { chartPanelWidth : size . width } ) }
705
+ resizeHandles = { [ 'w' ] }
706
+ className = { styles . chartPanel }
707
+ >
708
+ < div className = { styles . chartPanelContainer } >
709
+ < ChartVisualization
710
+ selectedData = { this . state . selectedData }
711
+ selectedCells = { this . state . selectedCells }
712
+ data = { this . props . data }
713
+ order = { this . state . order }
714
+ />
715
+ </ div >
716
+ </ ResizableBox >
717
+ ) }
685
718
</ div >
686
719
687
720
< BrowserToolbar
@@ -711,6 +744,8 @@ export default class DataBrowser extends React.Component {
711
744
allClassesSchema = { this . state . allClassesSchema }
712
745
togglePanel = { this . togglePanelVisibility }
713
746
isPanelVisible = { this . state . isPanelVisible }
747
+ toggleChartPanel = { this . toggleChartPanelVisibility }
748
+ isChartPanelVisible = { this . state . isChartPanelVisible }
714
749
appId = { this . props . app . applicationId }
715
750
appName = { this . props . appName }
716
751
{ ...other }
0 commit comments