Skip to content

Commit d8e44f8

Browse files
committed
Linting/formatting
1 parent ae9eba5 commit d8e44f8

File tree

2 files changed

+30
-28
lines changed

2 files changed

+30
-28
lines changed

src/plots/template_attributes.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ function templateFormatStringDescription(opts) {
99

1010
return [
1111
'Variables are inserted using %{variable},',
12-
'for example "y: %{y}"' + (
13-
supportOther ?
14-
' as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, *xother* will be added to those with different x positions from the first point. An underscore before or after *(x|y)other* will add a space on that side, only when this field is shown.' :
15-
'.'
16-
),
12+
'for example "y: %{y}"' +
13+
(supportOther
14+
? ' as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, *xother* will be added to those with different x positions from the first point. An underscore before or after *(x|y)other* will add a space on that side, only when this field is shown.'
15+
: '.'),
1716
'Numbers are formatted using d3-format\'s syntax %{variable:d3-format}, for example "Price: %{y:$.2f}".',
1817
FORMAT_LINK,
1918
'for details on the formatting syntax.',
@@ -37,29 +36,30 @@ function shapeTemplateFormatStringDescription() {
3736
'A single multiplication or division operation may be applied to numeric variables, and combined with',
3837
'd3 number formatting, for example "Length in cm: %{x0*2.54}", "%{slope*60:.1f} meters per second."',
3938
'For log axes, variable values are given in log units.',
40-
'For date axes, x/y coordinate variables and center variables use datetimes, while all other variable values use values in ms.',
39+
'For date axes, x/y coordinate variables and center variables use datetimes, while all other variable values use values in ms.'
4140
].join(' ');
4241
}
4342

4443
function describeVariables(extra) {
4544
var descPart = extra.description ? ' ' + extra.description : '';
4645
var keys = extra.keys || [];
47-
if(keys.length > 0) {
46+
if (keys.length > 0) {
4847
var quotedKeys = [];
49-
for(var i = 0; i < keys.length; i++) {
48+
for (var i = 0; i < keys.length; i++) {
5049
quotedKeys[i] = '`' + keys[i] + '`';
5150
}
5251
descPart = descPart + 'Finally, the template string has access to ';
53-
if(keys.length === 1) {
52+
if (keys.length === 1) {
5453
descPart = descPart + 'variable ' + quotedKeys[0];
5554
} else {
56-
descPart = descPart + 'variables ' + quotedKeys.slice(0, -1).join(', ') + ' and ' + quotedKeys.slice(-1) + '.';
55+
descPart =
56+
descPart + 'variables ' + quotedKeys.slice(0, -1).join(', ') + ' and ' + quotedKeys.slice(-1) + '.';
5757
}
5858
}
5959
return descPart;
6060
}
6161

62-
exports.hovertemplateAttrs = function(opts, extra) {
62+
exports.hovertemplateAttrs = function (opts, extra) {
6363
opts = opts || {};
6464
extra = extra || {};
6565

@@ -72,7 +72,7 @@ exports.hovertemplateAttrs = function(opts, extra) {
7272
description: [
7373
'Template string used for rendering the information that appear on hover box.',
7474
'Note that this will override `hoverinfo`.',
75-
templateFormatStringDescription({supportOther: true}),
75+
templateFormatStringDescription({ supportOther: true }),
7676
'The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data.',
7777
'Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available.',
7878
descPart,
@@ -81,14 +81,14 @@ exports.hovertemplateAttrs = function(opts, extra) {
8181
].join(' ')
8282
};
8383

84-
if(opts.arrayOk !== false) {
84+
if (opts.arrayOk !== false) {
8585
hovertemplate.arrayOk = true;
8686
}
8787

8888
return hovertemplate;
8989
};
9090

91-
exports.texttemplateAttrs = function(opts, extra) {
91+
exports.texttemplateAttrs = function (opts, extra) {
9292
opts = opts || {};
9393
extra = extra || {};
9494

@@ -107,14 +107,13 @@ exports.texttemplateAttrs = function(opts, extra) {
107107
].join(' ')
108108
};
109109

110-
if(opts.arrayOk !== false) {
110+
if (opts.arrayOk !== false) {
111111
texttemplate.arrayOk = true;
112112
}
113113
return texttemplate;
114114
};
115115

116-
117-
exports.shapeTexttemplateAttrs = function(opts, extra) {
116+
exports.shapeTexttemplateAttrs = function (opts, extra) {
118117
opts = opts || {};
119118
extra = extra || {};
120119

@@ -127,10 +126,10 @@ exports.shapeTexttemplateAttrs = function(opts, extra) {
127126
dflt: '',
128127
editType: opts.editType || 'arraydraw',
129128
description: [
130-
'Template string used for rendering the ' + newStr + 'shape\'s label.',
129+
'Template string used for rendering the ' + newStr + "shape's label.",
131130
'Note that this will override `text`.',
132131
shapeTemplateFormatStringDescription(),
133-
descPart,
132+
descPart
134133
].join(' ')
135134
};
136135
return texttemplate;

src/traces/histogram2d/attributes.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,18 @@ module.exports = extendFlat(
6969
xhoverformat: axisHoverFormat('x'),
7070
yhoverformat: axisHoverFormat('y'),
7171
zhoverformat: axisHoverFormat('z', 1),
72-
hovertemplate: hovertemplateAttrs({}, {keys: 'z'}),
73-
texttemplate: texttemplateAttrs({
74-
arrayOk: false,
75-
editType: 'plot'
76-
}, {
77-
keys: 'z'
78-
}),
72+
hovertemplate: hovertemplateAttrs({}, { keys: 'z' }),
73+
texttemplate: texttemplateAttrs(
74+
{
75+
arrayOk: false,
76+
editType: 'plot'
77+
},
78+
{
79+
keys: 'z'
80+
}
81+
),
7982
textfont: heatmapAttrs.textfont,
80-
showlegend: extendFlat({}, baseAttrs.showlegend, {dflt: false})
83+
showlegend: extendFlat({}, baseAttrs.showlegend, { dflt: false })
8184
},
82-
colorScaleAttrs('', {cLetter: 'z', autoColorDflt: false})
85+
colorScaleAttrs('', { cLetter: 'z', autoColorDflt: false })
8386
);

0 commit comments

Comments
 (0)