Skip to content

Commit

Permalink
address feedbacks and change bar plot panel as well
Browse files Browse the repository at this point in the history
  • Loading branch information
moontrip committed Sep 13, 2023
1 parent 1338056 commit 2cb2efc
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { CategoricalMarkerConfigurationTable } from './CategoricalMarkerConfigur
import { CategoricalMarkerPreview } from './CategoricalMarkerPreview';
import Barplot from '@veupathdb/components/lib/plots/Barplot';
import { SubsettingClient } from '../../../core/api';
import LabelledGroup from '@veupathdb/components/lib/components/widgets/LabelledGroup';
import { Toggle } from '@veupathdb/coreui';
import { SharedMarkerConfigurations } from './PieMarkerConfigurationMenu';
import { useUncontrolledSelections } from '../hooks/uncontrolledSelections';
Expand All @@ -25,6 +24,7 @@ import {
SelectedCountsOption,
SelectedValues,
} from '../appState';
import { gray } from '@veupathdb/coreui/lib/definitions/colors';

interface MarkerConfiguration<T extends string> {
type: T;
Expand Down Expand Up @@ -185,22 +185,27 @@ export function BarPlotMarkerConfigurationMenu({
>
Color:
</p>
<InputVariables
inputs={[
{
name: 'overlayVariable',
label: 'Variable',
titleOverride: ' ',
isNonNullable: true,
},
]}
entities={entities}
selectedVariables={{ overlayVariable: configuration.selectedVariable }}
onChange={handleInputVariablesOnChange}
starredVariables={starredVariables}
toggleStarredVariable={toggleStarredVariable}
constraints={constraints}
/>
{/* limit inputVariables width */}
<div style={{ maxWidth: '350px' }}>
<InputVariables
inputs={[
{
name: 'overlayVariable',
label: 'Variable',
titleOverride: ' ',
isNonNullable: true,
},
]}
entities={entities}
selectedVariables={{
overlayVariable: configuration.selectedVariable,
}}
onChange={handleInputVariablesOnChange}
starredVariables={starredVariables}
toggleStarredVariable={toggleStarredVariable}
constraints={constraints}
/>
</div>
<div style={{ margin: '5px 0 0 0' }}>
<span style={{ fontWeight: 'bold' }}>
Summary marker (all filtered data)
Expand All @@ -221,7 +226,17 @@ export function BarPlotMarkerConfigurationMenu({
continuousMarkerPreview
)}
</div>
<LabelledGroup label="Marker X-axis controls">
<div style={{ maxWidth: '360px', marginTop: '1em' }}>
<div
style={{
color: gray[900],
fontWeight: 500,
fontSize: '1.2em',
marginBottom: '0.5em',
}}
>
Marker X-axis controls
</div>
<RadioButtonGroup
containerStyles={
{
Expand All @@ -231,22 +246,28 @@ export function BarPlotMarkerConfigurationMenu({
label="Binning method"
selectedOption={configuration.binningMethod ?? 'equalInterval'}
options={['equalInterval', 'quantile', 'standardDeviation']}
optionLabels={[
'Equal interval',
'Quantile (10)',
'Standard deviation',
]}
optionLabels={['Equal interval', 'Quantile (10)', 'Std. dev.']}
buttonColor={'primary'}
// margins={['0em', '0', '0', '1em']}
// margins={['-1em', '0', '0', '0em']}
onOptionSelected={handleBinningMethodSelection}
disabledList={
overlayConfiguration?.overlayType === 'continuous'
? []
: ['equalInterval', 'quantile', 'standardDeviation']
}
/>
</LabelledGroup>
<LabelledGroup label="Marker Y-axis controls">
</div>
<div style={{ maxWidth: '360px', marginTop: '1em', marginBottom: '1em' }}>
<div
style={{
color: gray[900],
fontWeight: 500,
fontSize: '1.2em',
marginBottom: '0.5em',
}}
>
Marker Y-axis controls
</div>
<RadioButtonGroup
containerStyles={
{
Expand All @@ -258,7 +279,7 @@ export function BarPlotMarkerConfigurationMenu({
options={['count', 'proportion']}
optionLabels={['Count', 'Proportion']}
buttonColor={'primary'}
// margins={['0em', '0', '0', '1em']}
// margins={['-1em', '0', '0', '1em']}
onOptionSelected={handlePlotModeSelection}
/>
<Toggle
Expand All @@ -267,21 +288,23 @@ export function BarPlotMarkerConfigurationMenu({
value={configuration.dependentAxisLogScale}
onChange={handleLogScaleChange}
/>
</LabelledGroup>
</div>
{overlayConfiguration?.overlayType === 'categorical' && (
<CategoricalMarkerConfigurationTable
overlayValues={overlayConfiguration.overlayValues}
configuration={configuration}
onChange={onChange}
uncontrolledSelections={uncontrolledSelections}
setUncontrolledSelections={setUncontrolledSelections}
allCategoricalValues={
configuration.selectedCountsOption === 'filtered'
? allFilteredCategoricalValues
: allVisibleCategoricalValues
}
selectedCountsOption={configuration.selectedCountsOption}
/>
<div style={{ maxWidth: '360px', marginTop: '1em' }}>
<CategoricalMarkerConfigurationTable
overlayValues={overlayConfiguration.overlayValues}
configuration={configuration}
onChange={onChange}
uncontrolledSelections={uncontrolledSelections}
setUncontrolledSelections={setUncontrolledSelections}
allCategoricalValues={
configuration.selectedCountsOption === 'filtered'
? allFilteredCategoricalValues
: allVisibleCategoricalValues
}
selectedCountsOption={configuration.selectedCountsOption}
/>
</div>
)}
{overlayConfiguration?.overlayType === 'continuous' && barplotData.value && (
<div style={{ margin: '5px 0 0 0' }}>
Expand All @@ -301,8 +324,8 @@ export function BarPlotMarkerConfigurationMenu({
marginBottom: 0,
}}
containerStyles={{
height: 250,
width: 400,
height: '300px',
maxWidth: '360px',
}}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ export function CategoricalMarkerConfigurationTable<T>({
*/
key: 'label',
name: 'Values',
style: {
wordBreak: 'break-word',
hyphens: 'auto',
},
sortable: true,
renderCell: (data: { row: AllValuesDefinition }) => (
<>{data.row.label}</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@ export function PieMarkerConfigurationMenu({
// marginTop: 20,
}
}
label="Binning method (Dev. = Deviation)"
label="Binning method"
selectedOption={configuration.binningMethod ?? 'equalInterval'}
options={['equalInterval', 'quantile', 'standardDeviation']}
optionLabels={['Equal interval', 'Quantile (10)', 'Standard dev.']}
optionLabels={['Equal interval', 'Quantile (10)', 'Std. dev.']}
buttonColor={'primary'}
// margins={['0em', '0', '0', '1em']}
onOptionSelected={handleBinningMethodSelection}
Expand Down

0 comments on commit 2cb2efc

Please sign in to comment.