d3#HierarchyPointLink TypeScript Examples

The following examples show how to use d3#HierarchyPointLink. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: buildBrickEventDownstreamTree.ts    From next-basics with GNU General Public License v3.0 6 votes vote down vote up
export function computeEventDownstreamSourceX({
  source,
  target,
}: HierarchyPointLink<EventDownstreamNode>): number {
  if (target.data.type === EventDownstreamType.CALLBACK) {
    let x =
      source.x -
      source.data.height / 2 +
      styleConfig.node.padding +
      styleConfig.title.height +
      styleConfig.titleMarginBottom +
      target.data.parentHandlerIndex *
        (styleConfig.item.height + styleConfig.item.marginBottom) +
      styleConfig.item.height / 2;
    if (hasChannel(source.data)) {
      x += styleConfig.divider.height;
    }
    return x;
  }
  return source.x;
}