MCPcopy Index your code
hub / github.com/plotly/plotly.js / styleWaterfalls

Function styleWaterfalls

src/components/legend/style.js:276–323  ·  view source on GitHub ↗
(d)

Source from the content-addressed store, hash-verified

274 }
275
276 function styleWaterfalls(d) {
277 var trace = d[0].trace;
278 var isWaterfall = trace.type === 'waterfall';
279
280 if (d[0]._distinct && isWaterfall) {
281 var cont = d[0].trace[d[0].dir].marker;
282 d[0].mc = cont.color;
283 d[0].mlw = cont.line.width;
284 d[0].mlc = cont.line.color;
285 return styleBarLike(d, this, 'waterfall');
286 }
287
288 var ptsData = [];
289 if (trace.visible && isWaterfall) {
290 ptsData = d[0].hasTotals
291 ? [
292 ['increasing', 'M-6,-6V6H0Z'],
293 ['totals', 'M6,6H0L-6,-6H-0Z'],
294 ['decreasing', 'M6,6V-6H0Z']
295 ]
296 : [
297 ['increasing', 'M-6,-6V6H6Z'],
298 ['decreasing', 'M6,6V-6H-6Z']
299 ];
300 }
301
302 var pts = d3.select(this).select('g.legendpoints').selectAll('path.legendwaterfall').data(ptsData);
303 pts.enter()
304 .append('path')
305 .classed('legendwaterfall', true)
306 .attr('transform', centerTransform)
307 .style('stroke-miterlimit', 1);
308 pts.exit().remove();
309
310 pts.each(function (dd) {
311 var pt = d3.select(this);
312 var cont = trace[dd[0]].marker;
313 var lw = boundLineWidth(undefined, cont.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH);
314
315 pt.attr('d', dd[1])
316 .style('stroke-width', lw + 'px')
317 .call(Color.fill, cont.color);
318
319 if (lw) {
320 pt.call(Color.stroke, cont.line.color);
321 }
322 });
323 }
324
325 function styleBars(d) {
326 styleBarLike(d, this);

Callers

nothing calls this directly

Calls 2

styleBarLikeFunction · 0.85
boundLineWidthFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…