Skip to content

Commit e61d64d

Browse files
choropleth geojson improvements
1 parent 0193fa4 commit e61d64d

File tree

4 files changed

+46
-16
lines changed

4 files changed

+46
-16
lines changed

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/default_panels/GraphCreatePanel.js

Lines changed: 12 additions & 0 deletions
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,
@@ -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/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

0 commit comments

Comments
 (0)