diff --git a/dev/mocks.json b/dev/mocks.json index 372cbc945..9e1cebf8c 100644 --- a/dev/mocks.json +++ b/dev/mocks.json @@ -3,6 +3,7 @@ "/percy/panelTest.json", "/percy/histogram.json", "/percy/histogram2d.json", + "/percy/violin.json", "0.json", "1.json", "10.json", diff --git a/dev/percy/index.js b/dev/percy/index.js index 32a680630..f35bb460f 100644 --- a/dev/percy/index.js +++ b/dev/percy/index.js @@ -1,5 +1,6 @@ import panelTest from './panelTest.json'; import histogram from './histogram.json'; import histogram2d from './histogram2d.json'; +import violin from './violin.json'; -export {panelTest, histogram, histogram2d}; +export {panelTest, histogram, histogram2d, violin}; diff --git a/dev/percy/violin.json b/dev/percy/violin.json new file mode 100644 index 000000000..a33e89108 --- /dev/null +++ b/dev/percy/violin.json @@ -0,0 +1,28 @@ +{ + "data": [ + { + "type": "violin", + "mode": "markers", + "uid": "91db56", + "box": { + "visible": true + }, + "meanline": { + "visible": true + }, + "bandwidth": 0, + "x": [ + 1, + 2, + 3 + ], + "xsrc": "x1" + } + ], + "layout": { + "xaxis": {}, + "yaxis": {}, + "autosize": true + }, + "frames": [] +} diff --git a/src/__percy__/panels.percy.js b/src/__percy__/panels.percy.js index 9bd071ff6..cec8fc4d0 100644 --- a/src/__percy__/panels.percy.js +++ b/src/__percy__/panels.percy.js @@ -16,6 +16,7 @@ import './percy.css'; const panelsToTest = { histogram: ['GraphCreatePanel'], histogram2d: ['GraphCreatePanel', 'StyleTracesPanel'], + violin: ['GraphCreatePanel', 'StyleTracesPanel'], }; window.URL.createObjectURL = function() { diff --git a/src/default_panels/StyleTracesPanel.js b/src/default_panels/StyleTracesPanel.js index a306eb9a7..6b89d04a7 100644 --- a/src/default_panels/StyleTracesPanel.js +++ b/src/default_panels/StyleTracesPanel.js @@ -189,12 +189,25 @@ const StyleTracesPanel = (props, {localize: _}) => ( {label: _('Unsorted'), value: false}, ]} /> - + @@ -395,6 +408,27 @@ const StyleTracesPanel = (props, {localize: _}) => ( ]} /> + + + + + + ( {label: _('Hide'), value: false}, ]} /> + + + + + + + + + diff --git a/src/lib/constants.js b/src/lib/constants.js index 008e49e03..58e64145f 100644 --- a/src/lib/constants.js +++ b/src/lib/constants.js @@ -58,6 +58,7 @@ export const TRACE_TO_AXIS = { 'scatter', 'scattergl', 'box', + 'violin', 'bar', 'heatmap', 'heatmapgl', diff --git a/src/lib/customTraceType.js b/src/lib/customTraceType.js index 38b1be67c..d78efe9dc 100644 --- a/src/lib/customTraceType.js +++ b/src/lib/customTraceType.js @@ -49,6 +49,13 @@ export function traceTypeToPlotlyInitFigure(traceType) { type: 'box', boxpoints: false, }; + case 'violin': + return { + type: 'violin', + box: {visible: false}, + meanline: {visible: false}, + bandwidth: 0, + }; case 'line3d': return { type: 'scatter3d', diff --git a/src/lib/traceTypes.js b/src/lib/traceTypes.js index 95d748990..daf16da1d 100644 --- a/src/lib/traceTypes.js +++ b/src/lib/traceTypes.js @@ -126,11 +126,11 @@ export const traceTypes = _ => [ label: _('2D Contour Histogram'), category: chartCategory(_).DISTRIBUTIONS, }, - // { - // value: 'violin', - // label: _('Violin'), - // category: chartCategory(_).DISTRIBUTIONS, - // }, + { + value: 'violin', + label: _('Violin'), + category: chartCategory(_).DISTRIBUTIONS, + }, { value: 'choropleth', label: _('Choropleth'),