Skip to content

Commit 54ed82e

Browse files
wip
1 parent e930ad9 commit 54ed82e

File tree

8 files changed

+47
-28
lines changed

8 files changed

+47
-28
lines changed

src/components/containers/SubplotAccordion.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class SubplotAccordion extends Component {
6464
// of right type that have attr 'subplot': 'ternary' in their data.
6565

6666
/**
67-
Example:
67+
Example:
6868
{
6969
"data": [
7070
{
@@ -126,7 +126,9 @@ class SubplotAccordion extends Component {
126126
data.forEach((d, i) => {
127127
if (
128128
(d.type === 'pie' && d.values) ||
129-
['pie', 'table', 'sunburst', 'sankey', 'parcoords', 'parcats'].includes(d.type)
129+
['pie', 'table', 'sunburst', 'sankey', 'parcoords', 'parcats', 'funnelarea'].includes(
130+
d.type
131+
)
130132
) {
131133
counter[d.type]++;
132134
const currentCount = counter[d.type];

src/components/containers/TraceMarkerSection.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class TraceMarkerSection extends Component {
1717
const traceType = context.fullContainer.type;
1818
if (['bar', 'histogram'].includes(traceType)) {
1919
this.name = _('Bars');
20+
} else if (traceType === 'funnelarea') {
21+
this.name = _('Funnel Segments');
2022
} else if (traceType === 'pie') {
2123
this.name = _('Pie Segments');
2224
} else if (traceType === 'sunburst') {

src/components/fields/DataSelector.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export class UnconnectedDataSelector extends Component {
4040
'scatter',
4141
'scattergl',
4242
'bar',
43+
'funnel',
4344
'heatmap',
4445
'heatmapgl',
4546
'violin',

src/components/fields/TextPosition.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,17 @@ export default connectToContainer(UnconnectedTextPosition, {
9191
{label: _('Bottom Center'), value: 'bottom center'},
9292
{label: _('Bottom Right'), value: 'bottom right'},
9393
];
94-
if (['pie', 'bar', 'waterfall'].includes(context.container.type)) {
94+
if (['pie', 'bar', 'funnel', 'waterfall'].includes(context.container.type)) {
9595
options = [
9696
{label: _('Inside'), value: 'inside'},
9797
{label: _('Outside'), value: 'outside'},
9898
{label: _('Auto'), value: 'auto'},
9999
{label: _('None'), value: 'none'},
100100
];
101101
}
102+
if (['funnelarea'].includes(context.container.type)) {
103+
options = [{label: _('Inside'), value: 'inside'}, {label: _('None'), value: 'none'}];
104+
}
102105
plotProps.options = options;
103106
plotProps.clearable = false;
104107
},

src/components/fields/derived.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,11 +591,11 @@ export const HoverInfo = connectToContainer(UnconnectedFlaglist, {
591591
options = [];
592592
}
593593

594-
if (container.labels && ['pie', 'sunburst'].includes(container.type)) {
594+
if (container.labels && ['pie', 'sunburst', 'funnelarea'].includes(container.type)) {
595595
options.push({label: _('Label'), value: 'label'});
596596
}
597597

598-
if (container.values && ['pie', 'sunburst'].includes(container.type)) {
598+
if (container.values && ['pie', 'sunburst', 'funnelarea'].includes(container.type)) {
599599
options.push({label: _('Value'), value: 'value'});
600600
}
601601

src/default_panels/StyleTracesPanel.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,28 @@ const StyleTracesPanel = (props, {localize: _}) => (
122122
/>
123123
</LayoutSection>
124124
</TraceTypeSection>
125-
<PlotlySection name={_('Pie Title')} attr="title.text">
125+
<TraceTypeSection name={_('Funnel Area Colors')} traceTypes={['funnelarea']} mode="trace">
126+
<LayoutSection attr="name">
127+
<ColorwayPicker label={_('Colors')} attr="funnelareacolorway" />
128+
<Radio
129+
label={_('Extended Colors')}
130+
attr="extendfunnelareacolors"
131+
options={[{label: _('On'), value: true}, {label: _('Off'), value: false}]}
132+
/>
133+
</LayoutSection>
134+
</TraceTypeSection>
135+
<PlotlySection name={_('Funnel Dimensions')} traceTypes={['funnelarea']} attr="aspectratio">
136+
<Numeric
137+
label={_('Aspect Ratio')}
138+
attr="aspectratio"
139+
step={0.01}
140+
min={0}
141+
max={2}
142+
showSlider
143+
/>
144+
<NumericFraction label={_('Base Ratio')} attr="baseratio" />
145+
</PlotlySection>
146+
<PlotlySection name={_('Subplot Title')} attr="title.text">
126147
<TextEditor label={_('Name')} attr="title.text" />
127148
<Dropdown
128149
label={'Title Position'}
@@ -637,6 +658,7 @@ const StyleTracesPanel = (props, {localize: _}) => (
637658
attr="connector.visible"
638659
options={[{label: _('Show'), value: true}, {label: _('Hide'), value: false}]}
639660
/>
661+
<MultiColorPicker label={_('Fill Color')} attr="connector.fillcolor" />
640662
<Numeric label={_('Line Width')} attr="connector.line.width" />
641663
<MultiColorPicker label={_('Line Color')} attr="connector.line.color" />
642664
<LineDashSelector label={_('Line Type')} attr="connector.line.dash" />

src/lib/customTraceType.js

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import {COLORS} from 'lib/constants';
2-
31
export function plotlyTraceToCustomTrace(trace) {
42
if (typeof trace !== 'object') {
53
throw new Error(
@@ -45,29 +43,10 @@ export function traceTypeToPlotlyInitFigure(traceType, gl = '') {
4543
return {type: 'scatter' + gl, mode: 'lines', stackgroup: 1};
4644
case 'scatterpolar':
4745
return {type: 'scatterpolar' + gl};
48-
case 'ohlc':
49-
return {
50-
type: 'ohlc',
51-
decreasing: {line: {color: COLORS.middleGray}},
52-
increasing: {line: {color: COLORS.blueTeal}},
53-
};
5446
case 'waterfall':
5547
return {
5648
type: 'waterfall',
57-
decreasing: {line: {color: COLORS.middleGray}},
58-
increasing: {line: {color: COLORS.blueTeal}},
59-
};
60-
case 'candlestick':
61-
return {
62-
type: 'candlestick',
63-
decreasing: {
64-
line: {color: COLORS.middleGray},
65-
fillcolor: 'rgba(127, 127, 127, 0.5)',
66-
},
67-
increasing: {
68-
line: {color: COLORS.blueTeal},
69-
fillcolor: 'rgba(23, 190, 207, 0.5)',
70-
},
49+
orientation: 'v',
7150
};
7251
case 'box':
7352
return {

src/lib/traceTypes.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,16 @@ export const traceTypes = _ => [
200200
label: _('Waterfall'),
201201
category: chartCategory(_).FINANCIAL,
202202
},
203+
{
204+
value: 'funnel',
205+
label: _('Funnel'),
206+
category: chartCategory(_).FINANCIAL,
207+
},
208+
{
209+
value: 'funnelarea',
210+
label: _('Funnel Area'),
211+
category: chartCategory(_).FINANCIAL,
212+
},
203213
{
204214
value: 'scattergl',
205215
icon: 'scatter',

0 commit comments

Comments
 (0)