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

Function determineInsideTextFont

src/traces/pie/plot.js:586–647  ·  view source on GitHub ↗
(trace, pt, layoutFont)

Source from the content-addressed store, hash-verified

584}
585
586function determineInsideTextFont(trace, pt, layoutFont) {
587 var customColor = helpers.castOption(trace.insidetextfont.color, pt.pts);
588 if (!customColor && trace._input.textfont) {
589 // Why not simply using trace.textfont? Because if not set, it
590 // defaults to layout.font which has a default color. But if
591 // textfont.color and insidetextfont.color don't supply a value,
592 // a contrasting color shall be used.
593 customColor = helpers.castOption(trace._input.textfont.color, pt.pts);
594 }
595
596 var family =
597 helpers.castOption(trace.insidetextfont.family, pt.pts) ||
598 helpers.castOption(trace.textfont.family, pt.pts) ||
599 layoutFont.family;
600
601 var size =
602 helpers.castOption(trace.insidetextfont.size, pt.pts) ||
603 helpers.castOption(trace.textfont.size, pt.pts) ||
604 layoutFont.size;
605
606 var weight =
607 helpers.castOption(trace.insidetextfont.weight, pt.pts) ||
608 helpers.castOption(trace.textfont.weight, pt.pts) ||
609 layoutFont.weight;
610
611 var style =
612 helpers.castOption(trace.insidetextfont.style, pt.pts) ||
613 helpers.castOption(trace.textfont.style, pt.pts) ||
614 layoutFont.style;
615
616 var variant =
617 helpers.castOption(trace.insidetextfont.variant, pt.pts) ||
618 helpers.castOption(trace.textfont.variant, pt.pts) ||
619 layoutFont.variant;
620
621 var textcase =
622 helpers.castOption(trace.insidetextfont.textcase, pt.pts) ||
623 helpers.castOption(trace.textfont.textcase, pt.pts) ||
624 layoutFont.textcase;
625
626 var lineposition =
627 helpers.castOption(trace.insidetextfont.lineposition, pt.pts) ||
628 helpers.castOption(trace.textfont.lineposition, pt.pts) ||
629 layoutFont.lineposition;
630
631 var shadow =
632 helpers.castOption(trace.insidetextfont.shadow, pt.pts) ||
633 helpers.castOption(trace.textfont.shadow, pt.pts) ||
634 layoutFont.shadow;
635
636 return {
637 color: customColor || Color.contrast(pt.color),
638 family: family,
639 size: size,
640 weight: weight,
641 style: style,
642 variant: variant,
643 textcase: textcase,

Callers 2

plotFunction · 0.70
plot.jsFile · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…