From 7c3d481fdd5a2dfa01a9aac7999773d6c069a5d5 Mon Sep 17 00:00:00 2001 From: kb- Date: Sat, 12 Oct 2024 22:29:52 +0200 Subject: [PATCH] fixed violin defaults --- src/traces/violin/defaults.js | 3 + ...ooltip_tooltiptemplate_violin_grouped.json | 93 +++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 test/image/mocks/tooltip_tooltiptemplate_violin_grouped.json diff --git a/src/traces/violin/defaults.js b/src/traces/violin/defaults.js index fd60511bf9b..eff1ff016b4 100644 --- a/src/traces/violin/defaults.js +++ b/src/traces/violin/defaults.js @@ -49,6 +49,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout var meanLineVisible = coerce('meanline.visible', Boolean(meanLineColor || meanLineWidth)); if(!meanLineVisible) traceOut.meanline = {visible: false}; + coerce('tooltip'); + coerce('tooltiptemplate'); + coerce('quartilemethod'); coerce('zorder'); }; diff --git a/test/image/mocks/tooltip_tooltiptemplate_violin_grouped.json b/test/image/mocks/tooltip_tooltiptemplate_violin_grouped.json new file mode 100644 index 00000000000..51d197834f5 --- /dev/null +++ b/test/image/mocks/tooltip_tooltiptemplate_violin_grouped.json @@ -0,0 +1,93 @@ +{ + "data": [{ + "type": "violin", + "name": "kale", + "y": [ + 0.2, 0.2, 0.6, 1, 0.5, 0.4, + 0.2, 0.7, 0.9, 0.1, 0.5, 0.3 + ], + "x": [ + "day 1", "day 1", "day 1", "day 1", "day 1", "day 1", + "day 2", "day 2", "day 2", "day 2", "day 2", "day 2" + ], + "marker": { + "symbol": "line-ew", + "color": "#3D9970", + "line": { + "color": "#3D9970", + "width": 2 + } + }, + "points": "all", + "jitter": 0, + "span": [0, null], + "tooltiptemplate": "%{fullData.name}
x: %{x}
y: %{y}", + "tooltip": {"arrowcolor": "blue"} + }, { + "type": "violin", + "name": "radishes", + "y": [ + 0.6, 0.7, 0.3, 0.6, 0, 0.5, + 0.7, 0.9, 0.5, 0.8, 0.7, 0.2 + ], + "x": [ + "day 1", "day 1", "day 1", "day 1", "day 1", "day 1", + "day 2", "day 2", "day 2", "day 2", "day 2", "day 2" + ], + "marker": { + "symbol": "line-ew", + "color": "#FF4136", + "line": { + "color": "#FF4136", + "width": 2 + } + }, + "points": "all", + "jitter": 0, + "span": [0, null], + "tooltiptemplate": "%{fullData.name}
x: %{x}
y: %{y}", + "tooltip": {"arrowcolor": "blue"} + }, { + "type": "violin", + "name": "carrots", + "y": [ + 0.1, 0.3, 0.1, 0.9, 0.6, 0.6, + 0.9, 1, 0.3, 0.6, 0.8, 0.5 + ], + "x": [ + "day 1", "day 1", "day 1", "day 1", "day 1", "day 1", + "day 2", "day 2", "day 2", "day 2", "day 2", "day 2" + ], + "marker": { + "symbol": "line-ew", + "color": "#FF851B", + "line": { + "color": "#FF851B", + "width": 2 + } + }, + "points": "all", + "jitter": 0, + "span": [0, null], + "tooltiptemplate": "%{fullData.name}
x: %{x}
y: %{y}", + "tooltip": {"arrowcolor": "blue"} + }], + "layout": { + "yaxis": { + "zeroline": false, + "title": {"text": "normalized moisture"} + }, + "violinmode": "group" + }, + "config": { + "editable": true, + "modeBarButtonsToAdd": [ + "tooltip", + "hoverclosest", + "hovercompare", + "togglespikelines" + ], + "displaylogo": false, + "displayModeBar": true + } +}