Skip to content

Commit 6fbff97

Browse files
committed
lint (re-indent, rm whitespaces, some ;)
1 parent c01995e commit 6fbff97

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1244
-1214
lines changed

devtools/image_viewer/viewer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function createButton(imageName) {
5050

5151
$mock.innerHTML = '';
5252
$mock.appendChild(createJSONview(mock));
53-
});
53+
});
5454
});
5555

5656
return button;

devtools/test_dashboard/buttons.js

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* global Plotly:false Tabs:false */
2+
13
var plotlist = document.getElementById('plot-list');
24
var anchor = document.getElementById('embedded-graph');
35
var image = document.getElementById('embedded-image');
@@ -11,7 +13,7 @@ anchor.style.width = '1000px';
1113

1214
function plotButtons(plots, figDir) {
1315

14-
Object.keys(plots).forEach( function (plotname) {
16+
Object.keys(plots).forEach(function (plotname) {
1517

1618
var button = document.createElement('button');
1719

@@ -55,7 +57,7 @@ function plotButtons(plots, figDir) {
5557

5658
plotlist.appendChild(snapshot);
5759

58-
snapshot.addEventListener('click', function () {
60+
snapshot.addEventListener('click', function() {
5961

6062
/*
6163
* Grab the currently loaded plot and make an image - replacing the plot.
@@ -67,7 +69,7 @@ function plotButtons(plots, figDir) {
6769

6870
if (!layout || !data) return;
6971

70-
Plotly.Plots.getSubplotIds(gd._fullLayout, 'gl3d').forEach( function (key) {
72+
Plotly.Plots.getSubplotIds(gd._fullLayout, 'gl3d').forEach(function(key) {
7173
var scene = gd._fullLayout[key]._scene;
7274
scene.destroy();
7375
});
@@ -80,23 +82,23 @@ function plotButtons(plots, figDir) {
8082
/*
8183
* Replot with staticPlot
8284
*/
83-
Plotly.plot(gd, data, layout, {staticPlot: true, plotGlPixelRatio: 2}).then( function () {
84-
Plotly.Plots.getSubplotIds(gd._fullLayout, 'gl3d').forEach( function (key) {
85-
var scene = gd._fullLayout[key]._scene;
86-
var dataURL = scene.toImage();
87-
88-
var myImage = new Image();
89-
myImage.src = dataURL;
90-
91-
myImage.onload = function () {
92-
myImage.height = scene.container.clientHeight;
93-
myImage.width = scene.container.clientWidth;
94-
};
95-
96-
image.innerHTML = '';
97-
image.appendChild(myImage);
98-
});
99-
})
85+
Plotly.plot(gd, data, layout, {staticPlot: true, plotGlPixelRatio: 2}).then(function() {
86+
Plotly.Plots.getSubplotIds(gd._fullLayout, 'gl3d').forEach(function(key) {
87+
var scene = gd._fullLayout[key]._scene;
88+
var dataURL = scene.toImage();
89+
90+
var myImage = new Image();
91+
myImage.src = dataURL;
92+
93+
myImage.onload = function () {
94+
myImage.height = scene.container.clientHeight;
95+
myImage.width = scene.container.clientWidth;
96+
};
97+
98+
image.innerHTML = '';
99+
image.appendChild(myImage);
100+
});
101+
});
100102
});
101103

102104
var pummelButton = document.createElement('button');
@@ -122,7 +124,7 @@ function plotButtons(plots, figDir) {
122124

123125
Plotly.plot(plotDiv, mock.data, mock.layout, {staticPlot: true}).then(function () {
124126

125-
Plotly.Plots.getSubplotIds(plotDiv._fullLayout, 'gl3d').forEach( function (key) {
127+
Plotly.Plots.getSubplotIds(plotDiv._fullLayout, 'gl3d').forEach(function (key) {
126128
var scene = plotDiv._fullLayout[key]._scene;
127129
scene.destroy();
128130
i ++;

devtools/test_dashboard/server.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ var testFile;
1818
switch(process.argv[2]) {
1919
case 'cartesian':
2020
testFile = 'test_cartesian';
21-
break;
21+
break;
2222
case 'geo':
2323
testFile = 'test_geo';
24-
break;
24+
break;
2525
case 'gl3d':
2626
testFile = 'test_gl3d';
27-
break;
27+
break;
2828
default:
2929
testFile = 'test_gl2d';
3030
}

src/components/annotations/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,10 +533,10 @@ annotations.draw = function(gd, index, opt, value) {
533533
// line from the arrowhead to far away and reduce with xor
534534
// to get the parity of the number of intersections.
535535
if(edges.reduce(function(a, x) {
536-
return a ^
537-
!!lineIntersect(arrowX, arrowY, arrowX + 1e6, arrowY + 1e6,
538-
x[0], x[1], x[2], x[3]);
539-
},false)) {
536+
return a ^
537+
!!lineIntersect(arrowX, arrowY, arrowX + 1e6, arrowY + 1e6,
538+
x[0], x[1], x[2], x[3]);
539+
}, false)) {
540540
// no line or arrow - so quit drawArrow now
541541
return;
542542
}

src/components/colorbar/draw.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,13 @@ module.exports = function draw(gd, id) {
317317
fills.exit().remove();
318318
fills.each(function(d,i) {
319319
var z = [
320-
(i===0) ? zrange[0] :
321-
(filllevels[i]+filllevels[i-1])/2,
322-
(i===filllevels.length-1) ? zrange[1] :
323-
(filllevels[i]+filllevels[i+1])/2
324-
]
325-
.map(cbAxisOut.c2p)
326-
.map(Math.round);
320+
(i===0) ? zrange[0] :
321+
(filllevels[i]+filllevels[i-1])/2,
322+
(i===filllevels.length-1) ? zrange[1] :
323+
(filllevels[i]+filllevels[i+1])/2
324+
]
325+
.map(cbAxisOut.c2p)
326+
.map(Math.round);
327327

328328
// offset the side adjoining the next rectangle so they
329329
// overlap, to prevent antialiasing gaps

src/components/errorbars/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ errorBars.style = function(gd){
134134
function errorcoords(d, xa, ya) {
135135
// compute the coordinates of the error-bar objects
136136
var out = {
137-
x: xa.c2p(d.x),
138-
y: ya.c2p(d.y)
139-
};
137+
x: xa.c2p(d.x),
138+
y: ya.c2p(d.y)
139+
};
140140

141141
// calculate the error bar size and hat and shoe locations
142142
if(d.yh!==undefined) {

src/components/legend/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,13 @@ legend.texts = function(context, td, d, i, traces){
282282
.data([0]);
283283
text.enter().append('text').classed('legendtext', true);
284284
text.attr({
285-
x: 40,
286-
y: 0
287-
})
288-
.style('text-anchor', 'start')
289-
.call(Plotly.Drawing.font, fullLayout.legend.font)
290-
.text(name)
291-
.attr({'data-unformatted': name});
285+
x: 40,
286+
y: 0
287+
})
288+
.style('text-anchor', 'start')
289+
.call(Plotly.Drawing.font, fullLayout.legend.font)
290+
.text(name)
291+
.attr({'data-unformatted': name});
292292

293293
function textLayout(s){
294294
Plotly.util.convertToTspans(s, function(){
@@ -512,7 +512,7 @@ legend.draw = function(td) {
512512
}
513513
}
514514

515-
newVisible = trace.visible === true ? 'legendonly' : true;
515+
newVisible = trace.visible === true ? 'legendonly' : true;
516516
Plotly.restyle(td, 'visible', newVisible, traceIndicesInGroup);
517517
}
518518
});

src/components/modebar/buttons.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ function handleCartesian(gd, ev) {
250250
aobj[astr] = val;
251251
}
252252

253-
Plotly.relayout(gd, aobj).then( function() {
253+
Plotly.relayout(gd, aobj).then(function() {
254254
if(astr === 'dragmode') {
255255
if(fullLayout._hasCartesian) {
256256
Plotly.Fx.setCursor(
@@ -337,7 +337,7 @@ function handleCamera3d(gd, ev) {
337337
fullLayout = gd._fullLayout,
338338
sceneIds = Plotly.Plots.getSubplotIds(fullLayout, 'gl3d');
339339

340-
for(var i = 0; i < sceneIds.length; i++) {
340+
for(var i = 0; i < sceneIds.length; i++) {
341341
var sceneId = sceneIds[i],
342342
sceneLayout = layout[sceneId],
343343
fullSceneLayout = fullLayout[sceneId],
@@ -387,7 +387,7 @@ modeBarButtons.hoverClosest3d = {
387387
else {
388388
layoutUpdate = {'allaxes.showspikes': false};
389389

390-
for(var i = 0; i < sceneIds.length; i++) {
390+
for(var i = 0; i < sceneIds.length; i++) {
391391
var sceneId = sceneIds[i],
392392
sceneLayout = fullLayout[sceneId],
393393
sceneSpikes = currentSpikes[sceneId] = {};
@@ -456,7 +456,7 @@ function handleGeo(gd, ev) {
456456
fullLayout = gd._fullLayout,
457457
geoIds = Plotly.Plots.getSubplotIds(fullLayout, 'geo');
458458

459-
for(var i = 0; i < geoIds.length; i++) {
459+
for(var i = 0; i < geoIds.length; i++) {
460460
var geo = fullLayout[geoIds[i]]._geo;
461461

462462
if(attr === 'zoom') {
@@ -493,7 +493,7 @@ modeBarButtons.hoverClosestPie = {
493493
};
494494

495495
function toggleHover(gd) {
496-
var newHover = gd._fullLayout.hovermode ? false : 'closest';
496+
var newHover = gd._fullLayout.hovermode ? false : 'closest';
497497

498498
Plotly.relayout(gd, 'hovermode', newHover);
499499
}

src/components/modebar/manage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ function fillCustomButton(customButtons) {
186186
for(var j = 0; j < buttonGroup.length; j++) {
187187
var button = buttonGroup[j];
188188

189-
if(typeof button === 'string')
189+
if(typeof button === 'string') {
190190
if(modeBarButtons[button] !== undefined) {
191191
customButtons[i][j] = modeBarButtons[button];
192192
}
@@ -198,6 +198,7 @@ function fillCustomButton(customButtons) {
198198
}
199199
}
200200
}
201+
}
201202

202203
return customButtons;
203204
}

src/components/shapes/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ shapes.convertPath = function(pathIn, x2p, y2p) {
406406

407407
if(paramNumber > nParams) {
408408
paramString = paramString.replace(/[\s,]*X.*/, '');
409-
console.log('ignoring extra params in segment ' + segment);
409+
console.log('ignoring extra params in segment ' + segment);
410410
}
411411

412412
return segmentType + paramString;

src/components/titles/index.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ Titles.draw = function(gd, title) {
5656
fontColor = cont.titlefont.color,
5757
x,
5858
y,
59-
transform='',
60-
attr = {},
59+
transform = '',
6160
xa,
6261
ya,
6362
avoid = {
@@ -120,7 +119,6 @@ Titles.draw = function(gd, title) {
120119
xa._length + 10 +
121120
fontSize*(offsetBase + (ya.showticklabels ? 1 : 0.5)) :
122121
-10 - fontSize*(offsetBase + (ya.showticklabels ? 0.5 : 0)));
123-
attr = {center: 0};
124122
options = {x: x, y: y, 'text-anchor': 'middle'};
125123
transform = {rotate: '-90', offset: 0};
126124
if(!avoid.side) { avoid.side = 'left'; }
@@ -183,16 +181,18 @@ Titles.draw = function(gd, title) {
183181
'rotate(' + [transform.rotate, options.x, options.y] +
184182
') translate(0, '+transform.offset+')' :
185183
null);
184+
186185
titleEl.style({
187-
'font-family': font,
188-
'font-size': d3.round(fontSize,2)+'px',
189-
fill: Plotly.Color.rgb(fontColor),
190-
opacity: opacity*Plotly.Color.opacity(fontColor),
191-
'font-weight': plots.fontWeight
192-
})
193-
.attr(options)
194-
.call(Plotly.util.convertToTspans)
195-
.attr(options);
186+
'font-family': font,
187+
'font-size': d3.round(fontSize,2)+'px',
188+
fill: Plotly.Color.rgb(fontColor),
189+
opacity: opacity*Plotly.Color.opacity(fontColor),
190+
'font-weight': plots.fontWeight
191+
})
192+
.attr(options)
193+
.call(Plotly.util.convertToTspans)
194+
.attr(options);
195+
196196
titleEl.selectAll('tspan.line')
197197
.attr(options);
198198
return plots.previousPromises(gd);

src/lib/dates.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,9 @@ var dateTimeFormats = {
229229
dateTimeFormats[dateType].D.push(formatter(dateFormat));
230230
['H', 'I', 'D'].forEach(function(timeType) {
231231
timeFormats[timeType].forEach(function(timeFormat) {
232-
var a = dateTimeFormats[dateType][timeType];
233-
// 'date time', then 'time date'
232+
var a = dateTimeFormats[dateType][timeType];
233+
234+
// 'date time', then 'time date'
234235
a.push(formatter(dateFormat+'~'+timeFormat));
235236
a.push(formatter(timeFormat+'~'+dateFormat));
236237
});

src/lib/events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var Events = {
2121
* If we have already instantiated an emitter for this plot
2222
* return early.
2323
*/
24-
if (plotObj._ev instanceof EventEmitter) return plotObj;
24+
if (plotObj._ev instanceof EventEmitter) return plotObj;
2525

2626
var ev = new EventEmitter();
2727

0 commit comments

Comments
 (0)