MCPcopy Create free account
hub / github.com/tensorflow/tensorboard / stylize

Function stylize

tensorboard/plugins/graph/tf_graph_common/node.ts:871–907  ·  view source on GitHub ↗
(
  nodeGroup,
  renderInfo: render.RenderNodeInfo,
  sceneElement: TfGraphScene,
  nodeClass?
)

Source from the content-addressed store, hash-verified

869 * that can't be done in css).
870 */
871export function stylize(
872 nodeGroup,
873 renderInfo: render.RenderNodeInfo,
874 sceneElement: TfGraphScene,
875 nodeClass?
876) {
877 nodeClass = nodeClass || Class.Node.SHAPE;
878 const isHighlighted = sceneElement.isNodeHighlighted(renderInfo.node.name);
879 const isSelected = sceneElement.isNodeSelected(renderInfo.node.name);
880 const isExtract =
881 renderInfo.isInExtract ||
882 renderInfo.isOutExtract ||
883 renderInfo.isLibraryFunction;
884 const isExpanded = renderInfo.expanded && nodeClass !== Class.Annotation.NODE;
885 const isFadedOut = renderInfo.isFadedOut;
886 nodeGroup.classed('highlighted', isHighlighted);
887 nodeGroup.classed('selected', isSelected);
888 nodeGroup.classed('extract', isExtract);
889 nodeGroup.classed('expanded', isExpanded);
890 nodeGroup.classed('faded', isFadedOut);
891 // Main node always exists here and it will be reached before subscene,
892 // so d3 selection is fine here.
893 const node = nodeGroup.select(
894 '.' + nodeClass + ' .' + Class.Node.COLOR_TARGET
895 );
896 const fillColor = getFillForNode(
897 sceneElement.templateIndex,
898 sceneElement.colorBy,
899 renderInfo,
900 isExpanded,
901 sceneElement.getGraphSvgRoot()
902 );
903 node.style('fill', fillColor);
904 // Choose outline to be darker version of node color if the node is a single
905 // color and is not selected.
906 node.style('stroke', isSelected ? null : getStrokeForFill(fillColor));
907}
908/**
909 * Given a node's fill color/gradient, determine the stroke for the node.
910 */

Callers 2

buildGroupFunction · 0.70
updateFunction · 0.70

Calls 5

getFillForNodeFunction · 0.85
getStrokeForFillFunction · 0.85
isNodeHighlightedMethod · 0.80
isNodeSelectedMethod · 0.80
getGraphSvgRootMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…