Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/components/fields/derived.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,23 @@ export const TextPosition = connectToContainer(UnconnectedDropdown, {
},
});

export const TextInfo = connectToContainer(UnconnectedFlaglist, {
modifyPlotProps: (props, context, plotProps) => {
const {localize: _, container} = context;
const options = [
{label: _('Label'), value: 'label'},
{label: _('Value'), value: 'value'},
{label: _('%'), value: 'percent'},
];

if (container.text) {
options.push({label: _('Text'), value: 'text'});
}

plotProps.options = options;
},
});

export const HoverInfo = connectToContainer(UnconnectedFlaglist, {
modifyPlotProps: (props, context, plotProps) => {
const {localize: _, container} = context;
Expand Down
15 changes: 4 additions & 11 deletions src/default_panels/StyleTracesPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
BinningDropdown,
NumericReciprocal,
ShowInLegend,
TextInfo,
} from '../components/fields/derived';

const StyleTracesPanel = (props, {localize: _}) => (
Expand Down Expand Up @@ -94,17 +95,6 @@ const StyleTracesPanel = (props, {localize: _}) => (
/>
</PlotlySection>

<PlotlySection name={_('Text Attributes')}>
<Flaglist
attr="textinfo"
options={[
{label: _('Label'), value: 'label'},
{label: _('Text'), value: 'text'},
{label: _('Value'), value: 'value'},
{label: _('%'), value: 'percent'},
]}
/>
</PlotlySection>
<PlotlySection name={_('Header')}>
<Numeric label={_('Height')} attr="header.height" />
<MultiColorPicker label={_('Fill Color')} attr="header.fill.color" />
Expand Down Expand Up @@ -346,6 +336,9 @@ const StyleTracesPanel = (props, {localize: _}) => (
<FillDropdown attr="fill" label={_('Fill to')} />
<MultiColorPicker label={_('Color')} attr="fillcolor" />
</PlotlySection>
<PlotlySection name={_('Text Attributes')}>
<TextInfo attr="textinfo" />
</PlotlySection>
<TraceTypeSection
name={_('Text')}
traceTypes={[
Expand Down