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

Function styleCandles

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

Source from the content-addressed store, hash-verified

451 }
452
453 function styleCandles(d) {
454 var trace = d[0].trace;
455
456 var pts = d3
457 .select(this)
458 .select('g.legendpoints')
459 .selectAll('path.legendcandle')
460 .data(trace.visible && trace.type === 'candlestick' ? [d, d] : []);
461 pts.enter()
462 .append('path')
463 .classed('legendcandle', true)
464 .attr('d', function (_, i) {
465 if (i) return 'M-15,0H-8M-8,6V-6H8Z'; // increasing
466 return 'M15,0H8M8,-6V6H-8Z'; // decreasing
467 })
468 .attr('transform', centerTransform)
469 .style('stroke-miterlimit', 1);
470 pts.exit().remove();
471
472 pts.each(function (_, i) {
473 var p = d3.select(this);
474 var cont = trace[i ? 'increasing' : 'decreasing'];
475 var w = boundLineWidth(undefined, cont.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH);
476
477 p.style('stroke-width', w + 'px').call(Color.fill, cont.fillcolor);
478
479 if (w) Color.stroke(p, cont.line.color);
480 });
481 }
482
483 function styleOHLC(d) {
484 var trace = d[0].trace;

Callers

nothing calls this directly

Calls 1

boundLineWidthFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…