Make the controls on the Graph Visualiser collapsible and reorganize the controls.
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 108 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 86 KiB |
@ -338,6 +338,14 @@ Bar Charts, Stacked Bar Charts, and Pie Charts.
|
|||||||
:alt: Query tool graph visualiser panel
|
:alt: Query tool graph visualiser panel
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
|
* Graph Type
|
||||||
|
|
||||||
|
Choose the type of the graph that you would like to generate.
|
||||||
|
|
||||||
|
.. image:: images/query_graph_type.png
|
||||||
|
:alt: Query tool graph visualiser graph type
|
||||||
|
:align: center
|
||||||
|
|
||||||
* X Axis
|
* X Axis
|
||||||
|
|
||||||
Choose the column whose value you wish to display on X-axis from the *X Axis*
|
Choose the column whose value you wish to display on X-axis from the *X Axis*
|
||||||
@ -358,14 +366,6 @@ from the drop-down menu to select all the columns.
|
|||||||
:alt: Query tool graph visualiser yaxis
|
:alt: Query tool graph visualiser yaxis
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
* Graph Type
|
|
||||||
|
|
||||||
Choose the type of the graph that you would like to generate.
|
|
||||||
|
|
||||||
.. image:: images/query_graph_type.png
|
|
||||||
:alt: Query tool graph visualiser graph type
|
|
||||||
:align: center
|
|
||||||
|
|
||||||
* Download and Zoom button
|
* Download and Zoom button
|
||||||
|
|
||||||
Zooming is performed by clicking and selecting an area over the chart with the
|
Zooming is performed by clicking and selecting an area over the chart with the
|
||||||
|
@ -18,6 +18,8 @@ import { Box } from '@material-ui/core';
|
|||||||
import ShowChartRoundedIcon from '@material-ui/icons/ShowChartRounded';
|
import ShowChartRoundedIcon from '@material-ui/icons/ShowChartRounded';
|
||||||
import ZoomOutMapIcon from '@material-ui/icons/ZoomOutMap';
|
import ZoomOutMapIcon from '@material-ui/icons/ZoomOutMap';
|
||||||
import SaveAltIcon from '@material-ui/icons/SaveAlt';
|
import SaveAltIcon from '@material-ui/icons/SaveAlt';
|
||||||
|
import ExpandLessRoundedIcon from '@material-ui/icons/ExpandLessRounded';
|
||||||
|
import ExpandMoreRoundedIcon from '@material-ui/icons/ExpandMoreRounded';
|
||||||
import { InputSelect } from '../../../../../../static/js/components/FormComponents';
|
import { InputSelect } from '../../../../../../static/js/components/FormComponents';
|
||||||
import { DefaultButton, PgButtonGroup, PgIconButton} from '../../../../../../static/js/components/Buttons';
|
import { DefaultButton, PgButtonGroup, PgIconButton} from '../../../../../../static/js/components/Buttons';
|
||||||
import { LineChart, BarChart, PieChart, DATA_POINT_STYLE, DATA_POINT_SIZE,
|
import { LineChart, BarChart, PieChart, DATA_POINT_STYLE, DATA_POINT_SIZE,
|
||||||
@ -55,11 +57,16 @@ const useStyles = makeStyles((theme)=>({
|
|||||||
},
|
},
|
||||||
spanLabel: {
|
spanLabel: {
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
marginRight: '4px',
|
minWidth: '5%',
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
},
|
},
|
||||||
selectCtrl: {
|
selectCtrl: {
|
||||||
minWidth: '200px',
|
minWidth: '200px',
|
||||||
},
|
},
|
||||||
|
axisSelectCtrl: {
|
||||||
|
minWidth: '200px',
|
||||||
|
marginTop: '2px',
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// This function is used to generate the appropriate graph based on the graphType.
|
// This function is used to generate the appropriate graph based on the graphType.
|
||||||
@ -255,6 +262,7 @@ export function GraphVisualiser({initColumns}) {
|
|||||||
const [loaderText, setLoaderText] = useState('');
|
const [loaderText, setLoaderText] = useState('');
|
||||||
const [columns, setColumns] = useState(initColumns);
|
const [columns, setColumns] = useState(initColumns);
|
||||||
const [graphHeight, setGraphHeight] = useState();
|
const [graphHeight, setGraphHeight] = useState();
|
||||||
|
const [expandedState, setExpandedState] = useState(true);
|
||||||
|
|
||||||
|
|
||||||
// Create X axis options for drop down.
|
// Create X axis options for drop down.
|
||||||
@ -390,12 +398,6 @@ export function GraphVisualiser({initColumns}) {
|
|||||||
<Loader message={loaderText} />
|
<Loader message={loaderText} />
|
||||||
<Box className={classes.topContainer}>
|
<Box className={classes.topContainer}>
|
||||||
<Box className={classes.displayFlex}>
|
<Box className={classes.displayFlex}>
|
||||||
<Box className={classes.displayFlex}>
|
|
||||||
<span className={classes.spanLabel}>{graphType != 'P' ? gettext('X Axis') : gettext('Label')}</span>
|
|
||||||
<InputSelect className={classes.selectCtrl} options={xAxisOptions}
|
|
||||||
onChange={(v)=>setXAxis(v)} value={xaxis} optionsReloadBasis={optionsReload}/>
|
|
||||||
</Box>
|
|
||||||
<Box className={classes.displayFlex} marginLeft="auto">
|
|
||||||
<span className={classes.spanLabel} >{gettext('Graph Type')}</span>
|
<span className={classes.spanLabel} >{gettext('Graph Type')}</span>
|
||||||
<InputSelect className={classes.selectCtrl} controlProps={{allowClear: false}}
|
<InputSelect className={classes.selectCtrl} controlProps={{allowClear: false}}
|
||||||
options={[
|
options={[
|
||||||
@ -404,18 +406,33 @@ export function GraphVisualiser({initColumns}) {
|
|||||||
{label: gettext('Bar Chart'), value: 'B'},
|
{label: gettext('Bar Chart'), value: 'B'},
|
||||||
{label: gettext('Stacked Bar Chart'), value: 'SB'},
|
{label: gettext('Stacked Bar Chart'), value: 'SB'},
|
||||||
{label: gettext('Pie Chart'), value: 'P'},
|
{label: gettext('Pie Chart'), value: 'P'},
|
||||||
]} onChange={(v)=>setGraphType(v)} value={graphType} />
|
]} onChange={(v)=>{
|
||||||
</Box>
|
setGraphType(v);
|
||||||
<DefaultButton onClick={onGenerate} startIcon={<ShowChartRoundedIcon />}
|
if (graphType === 'P' || v === 'P') {
|
||||||
|
setExpandedState(true);
|
||||||
|
}
|
||||||
|
}} value={graphType} />
|
||||||
|
<DefaultButton style={{marginLeft: 'auto'}} onClick={onGenerate} startIcon={<ShowChartRoundedIcon />}
|
||||||
disabled={ _.isEmpty(xaxis) || yaxis.length <= 0 }>
|
disabled={ _.isEmpty(xaxis) || yaxis.length <= 0 }>
|
||||||
{gettext('Generate')}
|
{gettext('Generate')}
|
||||||
</DefaultButton>
|
</DefaultButton>
|
||||||
|
<PgIconButton title={expandedState ? gettext('Collapse') : gettext('Expand')}
|
||||||
|
icon={expandedState ? <ExpandLessRoundedIcon style={{height: '1.2rem'}}/> : <ExpandMoreRoundedIcon style={{height: '1.2rem'}}/>}
|
||||||
|
onClick={()=>{setExpandedState(!expandedState);}}/>
|
||||||
|
</Box>
|
||||||
|
{ expandedState && <>
|
||||||
|
<Box className={classes.displayFlex}>
|
||||||
|
<span className={classes.spanLabel}>{graphType != 'P' ? gettext('X Axis') : gettext('Label')}</span>
|
||||||
|
<InputSelect className={classes.axisSelectCtrl} options={xAxisOptions}
|
||||||
|
onChange={(v)=>setXAxis(v)} value={xaxis} optionsReloadBasis={optionsReload}/>
|
||||||
</Box>
|
</Box>
|
||||||
<Box className={classes.displayFlex}>
|
<Box className={classes.displayFlex}>
|
||||||
<span className={classes.spanLabel}>{graphType != 'P' ? gettext('Y Axis') : gettext('Value')}</span>
|
<span className={classes.spanLabel}>{graphType != 'P' ? gettext('Y Axis') : gettext('Value')}</span>
|
||||||
<InputSelect className={classes.selectCtrl} controlProps={{'multiple': graphType != 'P', allowSelectAll: graphType != 'P'}}
|
<InputSelect className={classes.axisSelectCtrl} controlProps={{'multiple': graphType != 'P', allowSelectAll: graphType != 'P'}}
|
||||||
options={yAxisOptions} onChange={(v)=>setYAxis(v)} value={yaxis} optionsReloadBasis={optionsReload}/>
|
options={yAxisOptions} onChange={(v)=>setYAxis(v)} value={yaxis} optionsReloadBasis={optionsReload}/>
|
||||||
</Box>
|
</Box>
|
||||||
|
</>
|
||||||
|
}
|
||||||
</Box>
|
</Box>
|
||||||
<Box display="flex" marginLeft="3px" marginTop="3px">
|
<Box display="flex" marginLeft="3px" marginTop="3px">
|
||||||
<PgButtonGroup size="small">
|
<PgButtonGroup size="small">
|
||||||
|