@@ -15,6 +15,7 @@ import { ResizableBox } from 'react-resizable';
1515import styles from './Databrowser.scss' ;
1616
1717import AggregationPanel from '../../../components/AggregationPanel/AggregationPanel' ;
18+ import ChartVisualization from '../../../components/ChartVisualization/ChartVisualization.react' ;
1819
1920/**
2021 * DataBrowser renders the browser toolbar and data table
@@ -49,6 +50,8 @@ export default class DataBrowser extends React.Component {
4950 isResizing : false ,
5051 maxWidth : window . innerWidth - 300 ,
5152 showAggregatedData : true ,
53+ isChartPanelVisible : false ,
54+ chartPanelWidth : 400 ,
5255 } ;
5356
5457 this . handleResizeDiv = this . handleResizeDiv . bind ( this ) ;
@@ -67,6 +70,7 @@ export default class DataBrowser extends React.Component {
6770 this . setSelectedObjectId = this . setSelectedObjectId . bind ( this ) ;
6871 this . setContextMenu = this . setContextMenu . bind ( this ) ;
6972 this . handleCellClick = this . handleCellClick . bind ( this ) ;
73+ this . toggleChartPanelVisibility = this . toggleChartPanelVisibility . bind ( this ) ;
7074 this . saveOrderTimeout = null ;
7175 }
7276
@@ -210,6 +214,12 @@ export default class DataBrowser extends React.Component {
210214 }
211215 }
212216
217+ toggleChartPanelVisibility ( ) {
218+ this . setState ( prevState => ( {
219+ isChartPanelVisible : ! prevState . isChartPanelVisible
220+ } ) ) ;
221+ }
222+
213223 getAllClassesSchema ( schema ) {
214224 const allClasses = Object . keys ( schema . data . get ( 'classes' ) . toObject ( ) ) ;
215225 const schemaSimplifiedData = { } ;
@@ -610,9 +620,7 @@ export default class DataBrowser extends React.Component {
610620 firstSelectedCell : clickedCellKey ,
611621 } ) ;
612622 }
613- }
614-
615- render ( ) {
623+ } render ( ) {
616624 const {
617625 className,
618626 count,
@@ -682,6 +690,31 @@ export default class DataBrowser extends React.Component {
682690 </ div >
683691 </ ResizableBox >
684692 ) }
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+ ) }
685718 </ div >
686719
687720 < BrowserToolbar
@@ -711,6 +744,8 @@ export default class DataBrowser extends React.Component {
711744 allClassesSchema = { this . state . allClassesSchema }
712745 togglePanel = { this . togglePanelVisibility }
713746 isPanelVisible = { this . state . isPanelVisible }
747+ toggleChartPanel = { this . toggleChartPanelVisibility }
748+ isChartPanelVisible = { this . state . isChartPanelVisible }
714749 appId = { this . props . app . applicationId }
715750 appName = { this . props . appName }
716751 { ...other }
0 commit comments