Skip to content

Commit 8452e53

Browse files
committed
limit variant options for scattergl and scatter3d - arrayOk scatter3d family supported now
1 parent 2fdb90c commit 8452e53

File tree

4 files changed

+28
-29
lines changed

4 files changed

+28
-29
lines changed

src/plots/font_attributes.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* @return {object} attributes object containing {family, size, color} as specified
1717
*/
1818
module.exports = function(opts) {
19+
var variantValues = opts.variantValues;
1920
var editType = opts.editType;
2021
var colorEditType = opts.colorEditType;
2122
if(colorEditType === undefined) colorEditType = editType;
@@ -73,12 +74,9 @@ module.exports = function(opts) {
7374
variant: {
7475
editType: editType,
7576
valType: 'enumerated',
76-
values: [
77+
values: variantValues || [
7778
'normal',
7879
'small-caps',
79-
// In WebGL-based traces e.g scattergl and scatter3d,
80-
// the only options are *normal* and *small-caps*.
81-
8280
'all-small-caps',
8381
'all-petite-caps',
8482
'petite-caps',

src/traces/scatter3d/attributes.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
var scatterAttrs = require('../scatter/attributes');
4+
var fontAttrs = require('../../plots/font_attributes');
45
var colorAttributes = require('../../components/colorscale/attributes');
56
var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat;
67
var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs;
@@ -155,14 +156,13 @@ var attrs = module.exports = overrideAll({
155156
),
156157

157158
textposition: extendFlat({}, scatterAttrs.textposition, {dflt: 'top center'}),
158-
textfont: {
159-
color: scatterAttrs.textfont.color,
160-
size: scatterAttrs.textfont.size,
161-
weight: scatterAttrs.textfont.weight,
162-
style: scatterAttrs.textfont.style,
163-
variant: scatterAttrs.textfont.variant,
164-
family: extendFlat({}, scatterAttrs.textfont.family, {arrayOk: false})
165-
},
159+
textfont: fontAttrs({
160+
editType: 'calc',
161+
colorEditType: 'style',
162+
arrayOk: true,
163+
variantValues: ['normal', 'small-caps'],
164+
description: 'Sets the text font.'
165+
}),
166166

167167
opacity: baseAttrs.opacity,
168168

src/traces/scattergl/attributes.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
var baseAttrs = require('../../plots/attributes');
4+
var fontAttrs = require('../../plots/font_attributes');
45
var makeFillcolorAttr = require('../scatter/fillcolor_attribute');
56
var scatterAttrs = require('../scatter/attributes');
67
var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat;
@@ -36,7 +37,13 @@ var attrs = module.exports = overrideAll({
3637
hovertext: scatterAttrs.hovertext,
3738

3839
textposition: scatterAttrs.textposition,
39-
textfont: scatterAttrs.textfont,
40+
textfont: fontAttrs({
41+
editType: 'calc',
42+
colorEditType: 'style',
43+
arrayOk: true,
44+
variantValues: ['normal', 'small-caps'],
45+
description: 'Sets the text font.'
46+
}),
4047

4148
mode: {
4249
valType: 'flaglist',

test/plot-schema.json

+10-16
Original file line numberDiff line numberDiff line change
@@ -58297,15 +58297,21 @@
5829758297
"editType": "none",
5829858298
"valType": "string"
5829958299
},
58300+
"description": "Sets the text font.",
5830058301
"editType": "calc",
5830158302
"family": {
58302-
"arrayOk": false,
58303+
"arrayOk": true,
5830358304
"description": "HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts if they aren't available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include *Arial*, *Balto*, *Courier New*, *Droid Sans*,, *Droid Serif*, *Droid Sans Mono*, *Gravitas One*, *Old Standard TT*, *Open Sans*, *Overpass*, *PT Sans Narrow*, *Raleway*, *Times New Roman*.",
5830458305
"editType": "calc",
5830558306
"noBlank": true,
5830658307
"strict": true,
5830758308
"valType": "string"
5830858309
},
58310+
"familysrc": {
58311+
"description": "Sets the source reference on Chart Studio Cloud for `family`.",
58312+
"editType": "none",
58313+
"valType": "string"
58314+
},
5830958315
"role": "object",
5831058316
"size": {
5831158317
"arrayOk": true,
@@ -58342,11 +58348,7 @@
5834258348
"valType": "enumerated",
5834358349
"values": [
5834458350
"normal",
58345-
"small-caps",
58346-
"all-small-caps",
58347-
"all-petite-caps",
58348-
"petite-caps",
58349-
"unicase"
58351+
"small-caps"
5835058352
]
5835158353
},
5835258354
"variantsrc": {
@@ -65012,11 +65014,7 @@
6501265014
"valType": "enumerated",
6501365015
"values": [
6501465016
"normal",
65015-
"small-caps",
65016-
"all-small-caps",
65017-
"all-petite-caps",
65018-
"petite-caps",
65019-
"unicase"
65017+
"small-caps"
6502065018
]
6502165019
},
6502265020
"variantsrc": {
@@ -70884,11 +70882,7 @@
7088470882
"valType": "enumerated",
7088570883
"values": [
7088670884
"normal",
70887-
"small-caps",
70888-
"all-small-caps",
70889-
"all-petite-caps",
70890-
"petite-caps",
70891-
"unicase"
70885+
"small-caps"
7089270886
]
7089370887
},
7089470888
"variantsrc": {

0 commit comments

Comments
 (0)