Skip to content

Commit 7ba7c57

Browse files
Merge pull request #1000 from plotly/enterprise3.4
Enterprise3.4
2 parents 47ccc1a + a16ccca commit 7ba7c57

File tree

12 files changed

+151
-35
lines changed

12 files changed

+151
-35
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-chart-editor",
33
"description": "plotly.js chart editor react component UI",
4-
"version": "0.40.3",
4+
"version": "0.41.0",
55
"author": "Plotly, Inc.",
66
"bugs": {
77
"url": "https://github.com/plotly/react-chart-editor/issues"
@@ -34,8 +34,8 @@
3434
"draft-js-utils": "^1.3.3",
3535
"fast-isnumeric": "^1.1.2",
3636
"immutability-helper": "^3.0.0",
37-
"plotly-icons": "1.3.13",
38-
"plotly.js": "1.51.3",
37+
"plotly-icons": "1.3.14",
38+
"plotly.js": "1.52.1",
3939
"prop-types": "^15.7.2",
4040
"raf": "^3.4.1",
4141
"react-color": "^2.17.0",

src/components/containers/SubplotAccordion.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ class SubplotAccordion extends Component {
118118
pie: 0,
119119
table: 0,
120120
sunburst: 0,
121+
treemap: 0,
121122
sankey: 0,
122123
parcoords: 0,
123124
parcats: 0,
@@ -126,9 +127,16 @@ class SubplotAccordion extends Component {
126127
data.forEach((d, i) => {
127128
if (
128129
(d.type === 'pie' && d.values) ||
129-
['pie', 'table', 'sunburst', 'sankey', 'parcoords', 'parcats', 'funnelarea'].includes(
130-
d.type
131-
)
130+
[
131+
'pie',
132+
'table',
133+
'sunburst',
134+
'treemap',
135+
'sankey',
136+
'parcoords',
137+
'parcats',
138+
'funnelarea',
139+
].includes(d.type)
132140
) {
133141
counter[d.type]++;
134142
const currentCount = counter[d.type];

src/components/containers/TraceMarkerSection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class TraceMarkerSection extends Component {
1717
const traceType = context.fullContainer.type;
1818
if (['bar', 'histogram', 'funnel', 'waterfall'].includes(traceType)) {
1919
this.name = _('Bars');
20-
} else if (['funnelarea', 'pie', 'sunburst'].includes(traceType)) {
20+
} else if (['funnelarea', 'pie', 'sunburst', 'treemap'].includes(traceType)) {
2121
this.name = _('Segments');
2222
} else {
2323
this.name = _('Points');

src/components/fields/Dropzone.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ UnconnectedDropzone.propTypes = {
2727
UnconnectedDropzone.displayName = 'UnconnectedDropzone';
2828

2929
function modifyPlotProps(props, context, plotProps) {
30-
if (context.container.type === 'choroplethmapbox') {
30+
if (context.container.type === 'choroplethmapbox' || context.container.type === 'choropleth') {
3131
plotProps.isVisible = true;
3232
}
3333
}

src/components/fields/LocationSelector.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class UnconnectedLocation extends Component {
2828
attr="locationmode"
2929
clearable={false}
3030
options={[
31+
{label: _('GeoJSON feature'), value: 'geojson-id'},
3132
{label: _('Country Names'), value: 'country names'},
3233
{label: _('Country Abbreviations (ISO-3)'), value: 'ISO-3'},
3334
{

src/components/fields/derived.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,11 @@ export const TickFormat = connectToContainer(UnconnectedDropdownCustom, {
169169

170170
export const ShowInLegend = connectToContainer(UnconnectedVisibilitySelect, {
171171
modifyPlotProps: (props, context, plotProps) => {
172-
if (context.container.type && context.container.type !== 'sunburst') {
172+
if (
173+
context.container.type &&
174+
context.container.type !== 'sunburst' &&
175+
context.container.type !== 'treemap'
176+
) {
173177
plotProps.isVisible = context.fullLayout.showlegend;
174178
}
175179

@@ -628,15 +632,15 @@ export const HoverInfo = connectToContainer(UnconnectedFlaglist, {
628632
{label: _('Norm'), value: 'norm'},
629633
{label: _('Divergence'), value: 'divergence'},
630634
];
631-
} else if (container.type === 'sunburst') {
635+
} else if (container.type === 'sunburst' || container.type === 'treemap') {
632636
options = [];
633637
}
634638

635-
if (container.labels && ['pie', 'sunburst', 'funnelarea'].includes(container.type)) {
639+
if (container.labels && ['pie', 'sunburst', 'treemap', 'funnelarea'].includes(container.type)) {
636640
options.push({label: _('Label'), value: 'label'});
637641
}
638642

639-
if (container.values && ['pie', 'sunburst', 'funnelarea'].includes(container.type)) {
643+
if (container.values && ['pie', 'sunburst', 'treemap', 'funnelarea'].includes(container.type)) {
640644
options.push({label: _('Value'), value: 'value'});
641645
}
642646

src/default_panels/GraphCreatePanel.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
33
import {
44
DataSelector,
55
Dropdown,
6+
DropdownCustom,
67
Radio,
78
PlotlySection,
89
AxesCreator,
@@ -37,7 +38,7 @@ const GraphCreatePanel = (props, {localize: _, setPanel}) => {
3738
<DataSelector label={_('Labels')} attr="labels" />
3839
<DataSelector label={_('Parents')} attr="parents" />
3940

40-
<TraceTypeSection traceTypes={['sunburst']} mode="trace">
41+
<TraceTypeSection traceTypes={['sunburst', 'treemap']} mode="trace">
4142
<DataSelector label={_('IDs')} attr="ids" />
4243
</TraceTypeSection>
4344
<Dropdown
@@ -74,6 +75,17 @@ const GraphCreatePanel = (props, {localize: _, setPanel}) => {
7475
}}
7576
attr="z"
7677
/>
78+
<DropdownCustom
79+
label={_('GeoJSON Location Field')}
80+
attr="featureidkey"
81+
options={[
82+
{label: _('id'), value: 'id'},
83+
{label: _('Custom'), value: 'custom'},
84+
]}
85+
customOpt="custom"
86+
dafaultOpt=""
87+
clearable={false}
88+
/>
7789
<Numeric label={_('Radius')} attr="radius" min={0} max={50} showSlider />
7890
<DataSelector label={_('Measure')} attr="measure" />
7991

src/default_panels/StyleLayoutPanel.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const StyleLayoutPanel = (props, {localize: _}) => (
5454
</PlotlySection>
5555
<PlotlySection name={_('Text')} attr="font.family">
5656
<FontSelector label={_('Typeface')} attr="font.family" clearable={false} />
57-
<Numeric label={_('Font Size')} attr="font.size" units="px" />
57+
<Numeric label={_('Base Font Size')} attr="font.size" units="px" />
5858
<ColorPicker label={_('Font Color')} attr="font.color" />
5959
<Dropdown
6060
label={_('Number format')}
@@ -67,6 +67,17 @@ const StyleLayoutPanel = (props, {localize: _}) => (
6767
]}
6868
clearable={false}
6969
/>
70+
<Dropdown
71+
label={_('Uniform Text Mode')}
72+
attr="uniformtext.mode"
73+
options={[
74+
{label: _('Off'), value: false},
75+
{label: _('Show'), value: 'show'},
76+
{label: _('Hide'), value: 'hide'},
77+
]}
78+
clearable={false}
79+
/>
80+
<Numeric label={_('Uniform Text Size Minimum')} attr="uniformtext.minsize" units="px" />
7081
</PlotlySection>
7182
</PlotlyFold>
7283

src/default_panels/StyleLegendPanel.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
PlotlySection,
1010
Dropdown,
1111
TraceRequiredPanel,
12+
TextEditor,
1213
} from '../components';
1314

1415
const StyleLegendPanel = (props, {localize: _}) => (
@@ -21,6 +22,13 @@ const StyleLegendPanel = (props, {localize: _}) => (
2122
{label: _('Hide'), value: false},
2223
]}
2324
/>
25+
26+
<PlotlySection name={_('Legend Title')}>
27+
<TextEditor label={_('Text')} attr="legend.title.text" richTextOnly />
28+
<FontSelector label={_('Typeface')} attr="legend.title.font.family" />
29+
<Numeric label={_('Size')} attr="legend.title.font.size" units="px" />
30+
<ColorPicker label={_('Color')} attr="legend.title.font.color" />
31+
</PlotlySection>
2432
<PlotlySection name={_('Text')}>
2533
<FontSelector label={_('Typeface')} attr="legend.font.family" />
2634
<Numeric label={_('Size')} attr="legend.font.size" units="px" />

src/default_panels/StyleMapsPanel.js

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ const StyleMapsPanel = (props, {localize: _}) => (
3535
<Numeric label={_('Zoom Level')} attr="zoom" min={0} />
3636
<Numeric label={_('Bearing')} attr="bearing" />
3737
<Numeric label={_('Pitch')} attr="pitch" min={0} />
38+
<Dropdown
39+
label={_('Bounds Fitting')}
40+
attr="fitbounds"
41+
options={[
42+
{label: _('Off'), value: false},
43+
{label: _('Locations'), value: 'locations'},
44+
{label: _('GeoJSON'), value: 'geojson'},
45+
]}
46+
clearable={false}
47+
/>
3848
</PlotlySection>
3949

4050
<PlotlySection name={_('Map Projection')}>
@@ -84,6 +94,28 @@ const StyleMapsPanel = (props, {localize: _}) => (
8494
{label: _('Sinusoidal'), value: 'sinusoidal'},
8595
]}
8696
/>
97+
<Numeric label={_('Scale')} attr="projection.scale" min={0} />
98+
<Numeric label={_('Center Latitude')} attr="projection.rotation.lon" min={0} />
99+
<Numeric label={_('Center Longitude')} attr="projection.rotation.lat" min={0} />
100+
<Numeric label={_('Roll')} attr="projection.rotation.roll" min={0} />
101+
</PlotlySection>
102+
103+
<PlotlySection name={_('Base Map')} attr="visible">
104+
<Radio
105+
attr="visible"
106+
options={[
107+
{label: _('Show'), value: true},
108+
{label: _('Hide'), value: false},
109+
]}
110+
/>
111+
<Radio
112+
label={_('Resolution')}
113+
attr="resolution"
114+
options={[
115+
{label: _('1:110,000,000'), value: 110},
116+
{label: _('1:50,000,000'), value: 50},
117+
]}
118+
/>
87119
</PlotlySection>
88120

89121
<PlotlySection name={_('Country Borders')} attr="showcountries">
@@ -172,21 +204,6 @@ const StyleMapsPanel = (props, {localize: _}) => (
172204
<Numeric label={_('Width')} attr="framewidth" units="px" />
173205
<ColorPicker label={_('Color')} attr="framecolor" />
174206
</PlotlySection>
175-
176-
<PlotlySection name={_('Map Options')}>
177-
<Radio
178-
label={_('Resolution')}
179-
attr="resolution"
180-
options={[
181-
{label: _('1:110,000,000'), value: 110},
182-
{label: _('1:50,000,000'), value: 50},
183-
]}
184-
/>
185-
<Numeric label={_('Scale')} attr="projection.scale" min={0} />
186-
<Numeric label={_('Latitude')} attr="projection.rotation.lon" min={0} />
187-
<Numeric label={_('Longitude')} attr="projection.rotation.lat" min={0} />
188-
<Numeric label={_('Roll')} attr="projection.rotation.roll" min={0} />
189-
</PlotlySection>
190207
</SubplotAccordion>
191208
);
192209

src/default_panels/StyleTracesPanel.js

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const StyleTracesPanel = (props, {localize: _}) => (
5656
<TraceAccordion canGroup>
5757
<TextEditor label={_('Name')} attr="name" richTextOnly />
5858
<NumericFraction label={_('Trace Opacity')} attr="opacity" />
59-
<TraceTypeSection name={_('Leaves')} traceTypes={['sunburst']} mode="trace">
59+
<TraceTypeSection name={_('Leaves')} traceTypes={['sunburst', 'treemap']} mode="trace">
6060
<LevelRendered label={_('Start at Level')} attr="level" />
6161
<Numeric label={_('Max Depth')} attr="maxdepth" min={-1} step={1} />
6262
<NumericFraction label={_('Opacity')} attr="leaf.opacity" />
@@ -99,7 +99,7 @@ const StyleTracesPanel = (props, {localize: _}) => (
9999
<MultiColorPicker label={_('Color')} attr="color" />
100100
<TraceTypeSection
101101
name={_('Segment Colors')}
102-
traceTypes={['pie', 'sunburst', 'funnelarea']}
102+
traceTypes={['pie', 'sunburst', 'treemap', 'funnelarea']}
103103
mode="trace"
104104
>
105105
<LayoutSection attr="name">
@@ -113,6 +113,7 @@ const StyleTracesPanel = (props, {localize: _}) => (
113113
]}
114114
/>
115115
<ColorwayPicker label={_('Colors')} attr="sunburstcolorway" />
116+
<ColorwayPicker label={_('Colors')} attr="treemapcolorway" />
116117
<Radio
117118
label={_('Extended Colors')}
118119
attr="extendsunburstcolors"
@@ -121,6 +122,14 @@ const StyleTracesPanel = (props, {localize: _}) => (
121122
{label: _('Off'), value: false},
122123
]}
123124
/>
125+
<Radio
126+
label={_('Extended Colors')}
127+
attr="extendtreemapcolors"
128+
options={[
129+
{label: _('On'), value: true},
130+
{label: _('Off'), value: false},
131+
]}
132+
/>
124133
<ColorwayPicker label={_('Colors')} attr="funnelareacolorway" />
125134
<Radio
126135
label={_('Extended Colors')}
@@ -633,9 +642,6 @@ const StyleTracesPanel = (props, {localize: _}) => (
633642
/>
634643
<Numeric label={_('Width')} attr="notchwidth" min={0} max={0.5} step={0.1} />
635644
</PlotlySection>
636-
<PlotlySection name={_('Text Attributes')}>
637-
<TextInfo attr="textinfo" />
638-
</PlotlySection>
639645
<TraceTypeSection
640646
name={_('Text')}
641647
traceTypes={allTraceTypes.filter(
@@ -653,11 +659,38 @@ const StyleTracesPanel = (props, {localize: _}) => (
653659
)}
654660
mode="trace"
655661
>
656-
<DataSelector label={_('Text')} attr="text" />
657662
<TextPosition label={_('Text Position')} attr="textposition" />
663+
<HoverTemplateSwitch attr="texttemplate" label={_('Mode')} />
664+
<TextInfo attr="textinfo" label={_('Show')} />
665+
<HoverTemplateText attr="texttemplate" label={_('Template')} />
666+
<DataSelector label={_('Text')} attr="text" />
658667
<FontSelector label={_('Typeface')} attr="textfont.family" />
659668
<Numeric label={_('Font Size')} attr="textfont.size" units="px" />
660669
<MultiColorPicker label={_('Font Color')} attr="textfont.color" />
670+
<Dropdown
671+
label={_('Inside Text Orientation')}
672+
options={[
673+
{label: _('Auto'), value: 'auto'},
674+
{label: _('Radial'), value: 'radial'},
675+
{label: _('Tangential'), value: 'tangential'},
676+
{label: _('Horizontal'), value: 'horizontal'},
677+
]}
678+
attr="insidetextorientation"
679+
clearable={false}
680+
/>
681+
<Dropdown
682+
label={_('Text Angle')}
683+
options={[
684+
{label: _('Auto'), value: 'auto'},
685+
{label: _('Horizontal'), value: 0},
686+
{label: _('Vertical Up'), value: -90},
687+
{label: _('Vertical Down'), value: 90},
688+
{label: _('Angled Down'), value: 45},
689+
{label: _('Angled Up'), value: -45},
690+
]}
691+
attr="textangle"
692+
clearable={false}
693+
/>
661694
<Dropdown
662695
label={_('Constrain Text')}
663696
options={[
@@ -855,6 +888,23 @@ const StyleTracesPanel = (props, {localize: _}) => (
855888
<MultiColorPicker label={_('Line Color')} attr="link.line.color" />
856889
<Numeric label={_('Line Width')} attr="link.line.width" min={0} />
857890
</PlotlySection>
891+
<PlotlySection name={_('Path Bar')} attr="pathbar.visible">
892+
<Radio
893+
attr="pathbar.visible"
894+
options={[
895+
{label: _('Show'), value: true},
896+
{label: _('Hide'), value: false},
897+
]}
898+
/>
899+
<Radio
900+
attr="pathbar.side"
901+
options={[
902+
{label: _('Top'), value: 'top'},
903+
{label: _('Bottom'), value: 'bottom'},
904+
]}
905+
label={_('Side')}
906+
/>
907+
</PlotlySection>
858908
<PlotlySection name={_('Hover/Tooltip')}>
859909
<HoveronDropdown attr="hoveron" label={_('Hover on')} />
860910
<Radio

src/lib/traceTypes.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ export const traceTypes = _ => [
190190
label: _('Sunburst'),
191191
category: chartCategory(_).SPECIALIZED,
192192
},
193+
{
194+
value: 'treemap',
195+
label: _('Treemap'),
196+
category: chartCategory(_).SPECIALIZED,
197+
},
193198
{
194199
value: 'sankey',
195200
label: _('Sankey'),

0 commit comments

Comments
 (0)