Skip to content

Commit a98ac44

Browse files
committed
image: in hovertemplate, rename c to color
1 parent e2a9c6e commit a98ac44

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

src/traces/image/attributes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,6 @@ module.exports = extendFlat({
102102
flags: ['x', 'y', 'z', 'color', 'name']
103103
}),
104104
hovertemplate: hovertemplateAttrs({}, {
105-
keys: ['z', 'c', 'colormodel']
105+
keys: ['z', 'color', 'colormodel']
106106
})
107107
});

src/traces/image/event_data.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
'use strict';
1010

1111
module.exports = function eventData(out, pt) {
12-
out.colormodel = pt.trace.colormodel;
1312
if('xVal' in pt) out.x = pt.xVal;
1413
if('yVal' in pt) out.y = pt.yVal;
1514
if(pt.xa) out.xaxis = pt.xa;
1615
if(pt.ya) out.yaxis = pt.ya;
17-
out.c = pt.c;
16+
out.color = pt.color;
17+
out.colormodel = pt.trace.colormodel;
1818
return out;
1919
};

src/traces/image/hover.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,19 @@ module.exports = function hoverPoints(pointData, xval, yval) {
6363
x1: xa.c2p(cd0.x0 + (nx + 1) * trace.dx),
6464
y0: py,
6565
y1: py,
66-
c: c,
66+
color: c,
6767
xVal: xVal,
6868
xLabelVal: xVal,
6969
yVal: yVal,
7070
yLabelVal: yVal,
7171
zLabelVal: zLabel,
7272
hovertemplateLabels: {
7373
'zLabel': zLabel,
74-
'cLabel': colorstring,
75-
'c[0]Label': c[0] + s[0],
76-
'c[1]Label': c[1] + s[1],
77-
'c[2]Label': c[2] + s[2]
74+
'colorLabel': colorstring,
75+
'color[0]Label': c[0] + s[0],
76+
'color[1]Label': c[1] + s[1],
77+
'color[2]Label': c[2] + s[2],
78+
'color[3]Label': c[3] + s[3]
7879
}
7980
})];
8081
};

test/jasmine/tests/image_test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,12 @@ describe('image hover:', function() {
397397
['x', '25.5'],
398398
['y', '14.5'],
399399
['z', '[54, 136, 153]'],
400-
['c', '[54, 136, 153]'],
401-
['c[0]', '54'],
402-
['c[0]', '54°', 'hsl'],
403-
['c[1]', '100%', 'hsl'],
404-
['c[2]', '100%', 'hsl'],
405-
['c[3]', '1', 'hsla'],
400+
['color', '[54, 136, 153]'],
401+
['color[0]', '54'],
402+
['color[0]', '54°', 'hsl'],
403+
['color[1]', '100%', 'hsl'],
404+
['color[2]', '100%', 'hsl'],
405+
['color[3]', '1', 'hsla'],
406406
].forEach(function(test) {
407407
it('should support hovertemplate variable ' + test[0], function(done) {
408408
var mockCopy = Lib.extendDeep({}, mock);

0 commit comments

Comments
 (0)