Skip to content

Commit e00cde4

Browse files
committed
handle transparent colors in violin
1 parent 23569cd commit e00cde4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/traces/violin/hover.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
'use strict';
22

3+
var tinycolor = require('tinycolor2');
4+
5+
var Color = require('../../components/color');
36
var Lib = require('../../lib');
47
var Axes = require('../../plots/cartesian/axes');
58
var boxHoverPoints = require('../box/hover');
@@ -75,7 +78,15 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, opts) {
7578

7679
closeData.push(kdePointData);
7780

78-
violinLineAttrs = {stroke: pointData.color};
81+
var strokeC = pointData.color;
82+
var strokeColor = tinycolor(strokeC);
83+
var strokeAlpha = strokeColor.getAlpha();
84+
var strokeRGB = Color.tinyRGB(strokeColor);
85+
86+
violinLineAttrs = {
87+
stroke: strokeRGB,
88+
'stroke-opacity': strokeAlpha
89+
};
7990
violinLineAttrs[pLetter + '1'] = Lib.constrain(paOffset + pOnPath[0], paOffset, paOffset + paLength);
8091
violinLineAttrs[pLetter + '2'] = Lib.constrain(paOffset + pOnPath[1], paOffset, paOffset + paLength);
8192
violinLineAttrs[vLetter + '1'] = violinLineAttrs[vLetter + '2'] = vAxis._offset + vValPx;

0 commit comments

Comments
 (0)