Skip to content

Commit 6567f65

Browse files
authored
Merge pull request #308 from plotly/3d
3d
2 parents 15c29f5 + 36ec121 commit 6567f65

File tree

4 files changed

+76
-11
lines changed

4 files changed

+76
-11
lines changed

src/components/fields/TraceSelector.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@ function computeTraceOptionsFromSchema(schema, _, context) {
3131
{value: 'violin', label: _('Violin')},
3232
{value: 'scatter3d', label: _('3D Scatter')},
3333
{value: 'surface', label: _('Surface')},
34-
{value: 'mesh3d', label: _('Mesh3d')},
34+
{value: 'mesh3d', label: _('3D Mesh')},
3535
{value: 'scattergeo', label: _('Atlas Map')},
3636
{value: 'choropleth', label: _('Choropleth')},
3737
{value: 'scattergl', label: _('Scatter GL')},
3838
{value: 'pointcloud', label: _('Point Cloud')},
3939
{value: 'heatmapgl', label: _('Heatmap GL')},
4040
{value: 'parcoords', label: _('Parallel Coordinates')},
41-
4241
{value: 'sankey', label: _('Sankey')},
4342
{value: 'table', label: _('Table')},
4443
{value: 'carpet', label: _('Carpet')},
@@ -49,15 +48,22 @@ function computeTraceOptionsFromSchema(schema, _, context) {
4948
{value: 'scatterpolar', label: _('Polar Scatter')},
5049
].filter(obj => traceTypes.indexOf(obj.value) !== -1);
5150

52-
const i = traceOptions.findIndex(opt => opt.value === 'scatter');
51+
const traceIndex = traceType =>
52+
traceOptions.findIndex(opt => opt.value === traceType);
53+
5354
traceOptions.splice(
54-
i + 1,
55+
traceIndex('scatter') + 1,
5556
0,
5657
{label: _('Line'), value: 'line'},
5758
{label: _('Area'), value: 'area'},
5859
{label: _('Timeseries'), value: 'timeseries'}
5960
);
6061

62+
traceOptions.splice(traceIndex('scatter3d') + 1, 0, {
63+
label: _('3D Line'),
64+
value: 'line3d',
65+
});
66+
6167
if (context.config && context.config.mapboxAccessToken) {
6268
traceOptions.push({value: 'scattermapbox', label: _('Satellite Map')});
6369
}

src/default_panels/GraphCreatePanel.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ const GraphCreatePanel = ({localize: _}) => {
2929
<DataSelector label={_('X')} attr="x" />
3030
<DataSelector label={_('Y')} attr="y" />
3131
<DataSelector label={{choropleth: _('Values'), '*': _('Z')}} attr="z" />
32+
<DataSelector label={_('I (Optional)')} attr="i" />
33+
<DataSelector label={_('J (Optional)')} attr="j" />
34+
<DataSelector label={_('K (Optional)')} attr="k" />
3235
<DataSelector label={_('Open')} attr="open" />
3336
<DataSelector label={_('High')} attr="high" />
3437
<DataSelector label={_('Low')} attr="low" />
@@ -39,6 +42,9 @@ const GraphCreatePanel = ({localize: _}) => {
3942
</Section>
4043

4144
<Section name={_('Options')}>
45+
<DataSelector label={_('Intensity')} attr="intensity" />
46+
<DataSelector label={_('Facecolor')} attr="facecolor" />
47+
<DataSelector label={_('Vertexcolor')} attr="vertexcolor" />
4248
<Dropdown
4349
label={_('Location Format')}
4450
attr="locationmode"

src/default_panels/StyleTracesPanel.js

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {localize} from '../lib';
2828
const StyleTracesPanel = ({localize: _}) => (
2929
<TraceAccordion>
3030
<Section name={_('Trace')} attr="name">
31+
<TextEditor label={_('Name')} attr="name" richTextOnly />
3132
<TraceOrientation
3233
label={_('Orientation')}
3334
attr="orientation"
@@ -38,16 +39,17 @@ const StyleTracesPanel = ({localize: _}) => (
3839
/>
3940

4041
<Numeric label={_('Opacity')} step={0.1} attr="opacity" />
42+
<ColorPicker label={_('Color')} attr="color" />
4143
</Section>
4244

4345
<Section name={_('Text Attributes')}>
4446
<Flaglist
4547
attr="textinfo"
4648
options={[
47-
{label: 'Label', value: 'label'},
48-
{label: 'Text', value: 'text'},
49-
{label: 'Value', value: 'value'},
50-
{label: '%', value: 'percent'},
49+
{label: _('Label'), value: 'label'},
50+
{label: _('Text'), value: 'text'},
51+
{label: _('Value'), value: 'value'},
52+
{label: _('%'), value: 'percent'},
5153
]}
5254
/>
5355
</Section>
@@ -56,8 +58,17 @@ const StyleTracesPanel = ({localize: _}) => (
5658
<Flaglist
5759
attr="mode"
5860
options={[
59-
{label: 'Lines', value: 'lines'},
60-
{label: 'Points', value: 'markers'},
61+
{label: _('Lines'), value: 'lines'},
62+
{label: _('Points'), value: 'markers'},
63+
{label: _('Text'), value: 'text'},
64+
]}
65+
/>
66+
<Radio
67+
attr="flatshading"
68+
label={_('flatshading')}
69+
options={[
70+
{label: _('Enable'), value: true},
71+
{label: _('Disable'), value: false},
6172
]}
6273
/>
6374
</Section>
@@ -125,9 +136,17 @@ const StyleTracesPanel = ({localize: _}) => (
125136
/>
126137
</TraceTypeSection>
127138

139+
<TraceTypeSection name={_('Lines')} traceTypes={['scatter3d']}>
140+
<Numeric label={_('Width')} attr="line.width" />
141+
<ColorPicker label={_('Line Color')} attr="line.color" />
142+
<LineDashSelector label={_('Type')} attr="line.dash" />
143+
<LineShapeSelector label={_('Shape')} attr="line.shape" />
144+
</TraceTypeSection>
145+
128146
<Section name={_('Colorscale')}>
129147
<ColorscalePicker label={_('Colorscale')} attr="colorscale" />
130148
<Radio
149+
label={_('Orientation')}
131150
attr="reversescale"
132151
options={[
133152
{label: _('Normal'), value: false},
@@ -236,6 +255,18 @@ const StyleTracesPanel = ({localize: _}) => (
236255
units="%"
237256
step={0.1}
238257
/>
258+
<Numeric
259+
label={_('Vertex Normal')}
260+
attr="lighting.vertexnormalsepsilon"
261+
units="%"
262+
step={0.1}
263+
/>
264+
<Numeric
265+
label={_('Face Normal')}
266+
attr="lighting.facenormalsepsilon"
267+
units="%"
268+
step={0.1}
269+
/>
239270
</Section>
240271

241272
<Section name={_('Light Position')}>
@@ -295,12 +326,22 @@ const StyleTracesPanel = ({localize: _}) => (
295326
/>
296327
</Section>
297328

298-
<Section name={_('Values Shown On Hover')}>
329+
<Section name={_('On Hover')}>
299330
<HoverInfo
300331
attr="hoverinfo"
301332
label={_('Values Shown On Hover')}
302333
localize={_}
303334
/>
335+
<Radio
336+
label={_('Show contour')}
337+
attr="contour.show"
338+
options={[
339+
{label: _('Show'), value: true},
340+
{label: _('Hide'), value: false},
341+
]}
342+
/>
343+
<ColorPicker label={_('Contour Color')} attr="contour.color" />
344+
<Numeric label={_('Contour Width')} attr="contour.width" />
304345
</Section>
305346

306347
<TraceTypeSection name={_('Hover Action')} traceTypes={['box']}>

src/lib/customTraceType.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export function plotlyTraceToCustomTrace(trace) {
1313
(trace.mode === 'lines' || trace.mode === 'lines+markers')
1414
) {
1515
return 'line';
16+
} else if (trace.type === 'scatter3d' && trace.mode === 'lines') {
17+
return 'line3d';
1618
}
1719
return trace.type;
1820
}
@@ -57,6 +59,16 @@ export function traceTypeToPlotlyInitFigure(traceType) {
5759
autobinx: true,
5860
autobiny: true,
5961
};
62+
case 'line3d':
63+
return {
64+
type: 'scatter3d',
65+
mode: 'lines',
66+
};
67+
case 'scatter3d':
68+
return {
69+
type: 'scatter3d',
70+
mode: 'markers',
71+
};
6072
default:
6173
return {type: traceType};
6274
}

0 commit comments

Comments
 (0)