From 62cbb9fd064fa4648296053ed299ec44858f4ae2 Mon Sep 17 00:00:00 2001 From: dmt0 Date: Tue, 3 Jul 2018 16:24:52 -0400 Subject: [PATCH 1/3] violins initial --- src/default_panels/StyleTracesPanel.js | 52 ++++++++++++++++++++++++++ src/lib/constants.js | 1 + src/lib/customTraceType.js | 7 ++++ src/lib/traceTypes.js | 10 ++--- 4 files changed, 65 insertions(+), 5 deletions(-) diff --git a/src/default_panels/StyleTracesPanel.js b/src/default_panels/StyleTracesPanel.js index a306eb9a7..748a00ec9 100644 --- a/src/default_panels/StyleTracesPanel.js +++ b/src/default_panels/StyleTracesPanel.js @@ -395,6 +395,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'), From f6768f6c024b6efd1211f62db8084d1286bed18f Mon Sep 17 00:00:00 2001 From: dmt0 Date: Thu, 5 Jul 2018 12:30:26 -0400 Subject: [PATCH 2/3] Violin Percy test --- dev/mocks.json | 1 + dev/percy/index.js | 3 ++- dev/percy/violin.json | 28 ++++++++++++++++++++++++++++ src/__percy__/panels.percy.js | 1 + 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 dev/percy/violin.json 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() { From 8af688ba5f53c800da908a33b264d4aa7f74fcb2 Mon Sep 17 00:00:00 2001 From: dmt0 Date: Thu, 5 Jul 2018 14:30:22 -0400 Subject: [PATCH 3/3] Add violin points, make box points a dropdown --- src/default_panels/StyleTracesPanel.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/default_panels/StyleTracesPanel.js b/src/default_panels/StyleTracesPanel.js index 748a00ec9..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}, ]} /> - +