Skip to content

Commit f13d7b2

Browse files
committed
scattergl
1 parent acc71b2 commit f13d7b2

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

src/traces/scattergl/convert.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ function convertTextStyle(gd, trace) {
107107
var tfc = textfontIn.color;
108108
var tfs = textfontIn.size;
109109
var tff = textfontIn.family;
110+
var tfw = textfontIn.weight;
111+
var tfy = textfontIn.style;
112+
var tfh = textfontIn.stretch;
113+
var tfv = textfontIn.variant;
110114
var optsOut = {};
111115
var i;
112116
var plotGlPixelRatio = gd._context.plotGlPixelRatio;
@@ -184,7 +188,14 @@ function convertTextStyle(gd, trace) {
184188
optsOut.color = tfc;
185189
}
186190

187-
if(isArrayOrTypedArray(tfs) || isArrayOrTypedArray(tff)) {
191+
if(
192+
isArrayOrTypedArray(tfs) ||
193+
Array.isArray(tff) ||
194+
Array.isArray(tfw) ||
195+
Array.isArray(tfy) ||
196+
Array.isArray(tfh) ||
197+
Array.isArray(tfv)
198+
) {
188199
// if any textfont param is array - make render a batch
189200
optsOut.font = new Array(count);
190201
for(i = 0; i < count; i++) {
@@ -197,11 +208,22 @@ function convertTextStyle(gd, trace) {
197208
) : tfs
198209
) * plotGlPixelRatio;
199210

200-
fonti.family = isArrayOrTypedArray(tff) ? tff[i] : tff;
211+
fonti.family = Array.isArray(tff) ? tff[i] : tff;
212+
fonti.weight = Array.isArray(tfw) ? tfw[i] : tfw;
213+
fonti.style = Array.isArray(tfy) ? tfy[i] : tfy;
214+
fonti.stretch = Array.isArray(tfh) ? tfh[i] : tfh;
215+
fonti.variant = Array.isArray(tfv) ? tfv[i] : tfv;
201216
}
202217
} else {
203218
// if both are single values, make render fast single-value
204-
optsOut.font = {size: tfs * plotGlPixelRatio, family: tff};
219+
optsOut.font = {
220+
size: tfs * plotGlPixelRatio,
221+
family: tff,
222+
weight: tfw,
223+
style: tfy,
224+
stretch: tfh,
225+
variant: tfv
226+
};
205227
}
206228

207229
return optsOut;

src/traces/scattergl/hover.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,12 @@ function calcHover(pointData, x, y, trace) {
130130
var font = trace.textfont;
131131
if(font) {
132132
di.ts = Lib.isArrayOrTypedArray(font.size) ? font.size[id] : font.size;
133-
di.tc = Array.isArray(font.color) ? font.color[id] : font.color;
133+
di.tc = Lib.isArrayOrTypedArray(font.color) ? font.color[id] : font.color;
134134
di.tf = Array.isArray(font.family) ? font.family[id] : font.family;
135+
di.tw = Array.isArray(font.weight) ? font.weight[id] : font.weight;
136+
di.ty = Array.isArray(font.style) ? font.style[id] : font.style;
137+
di.th = Array.isArray(font.stretch) ? font.stretch[id] : font.stretch;
138+
di.tv = Array.isArray(font.variant) ? font.variant[id] : font.variant;
135139
}
136140

137141
var marker = trace.marker;

0 commit comments

Comments
 (0)