pivotick - v2.0.1
    Preparing search index...

    Interface GraphRendererOptions

    interface GraphRendererOptions {
        beforeRender: (graph: Pivotick) => void;
        defaultEdgeStyle: EdgeStyle;
        defaultLabelStyle: LabelStyle;
        defaultNodeStyle: NodeStyle;
        dragEnabled: boolean;
        edgeStyleMap?: Record<string, Partial<EdgeStyle>>;
        edgeTypeAccessor?: (edge: Edge) => string | undefined;
        enableFocusMode: boolean;
        enableNodeExpansion: boolean;
        interactionEnabled: boolean;
        markerStyleMap?: MarkerStyleMap;
        maxZoom: number;
        minZoom: number;
        nodeStyleMap?: Record<string, Partial<NodeStyle>>;
        nodeTypeAccessor?: (node: Node) => string | undefined;
        renderCluster?: (cluster: Node) => string | void | HTMLElement;
        renderLabel?: (edge: Edge) => string | void | HTMLElement;
        renderNode?: (node: Node) => string | void | HTMLElement;
        selectionBox: SelectionBox;
        type: RendererType;
        zoomAnimation: boolean;
        zoomAnimationDuration: number;
        zoomEnabled: boolean;
    }
    Index

    Properties

    beforeRender: (graph: Pivotick) => void

    Callback executed during the init phase, before the first rendering

    Type Declaration

    defaultEdgeStyle: EdgeStyle

    The default edge style to be applied on all nodes

    defaultEdgeStyleValue

    defaultLabelStyle: LabelStyle

    The default edge's label style to be applied on all nodes

    defaultNodeStyle: NodeStyle

    The default node style to be applied on all nodes

    defaultNodeStyleValue

    dragEnabled: boolean
    true
    
    edgeStyleMap?: Record<string, Partial<EdgeStyle>>

    Maps edge kinds to their styles.

    Each key is an edge kind (as returned by edgeTypeAccessor) and maps to a partial EdgeStyle. An edge's own styleCb still wins over the map, exactly as it does over nodeStyleMap.

    Used in conjuction with edgeTypeAccessor

    edgeStyleMap: {
    'object-reference': { strokeColor: '#428bca' },
    'correlation': { strokeColor: '#888', dashed: true },
    }
    edgeTypeAccessor?: (edge: Edge) => string | undefined

    Function to access the kind of an edge — the dimension edgeStyleMap keys on, and the one an edge legend section and edge filter facets derive from when they aren't given a data key of their own.

    Used in conjuction with edgeStyleMap

    edgeTypeAccessor: (edge) => edge.getData()?.kind
    
    enableFocusMode: boolean

    Controls whether non-connected nodes and edges are grayed out when a node is selected

    true
    
    enableNodeExpansion: boolean

    Controls whether nodes can be expanded or collapsed to show their children

    true
    
    interactionEnabled: boolean
    true
    
    markerStyleMap?: MarkerStyleMap

    Defines custom styles for marker shapes used in the graph.

    Each key is a marker type (e.g., 'diamond', 'arrow') and maps to a MarkerStyle object.

    defaultMarkerStyleMap

    markerStyleMap: {
    'diamond': {
    fill: '#44c77f',
    },
    }
    maxZoom: number
    10
    
    minZoom: number
    0.05
    
    nodeStyleMap?: Record<string, Partial<NodeStyle>>

    Maps node types to their styles.

    Each key is a node type (as returned by nodeTypeAccessor) and maps to a NodeStyle object.

    Used in conjuction with nodeTypeAccessor

    nodeStyleMap: {
    'hub': { shape: 'hexagon', color: '#aaa', size: 30 },
    'spoke': { shape: 'triangle', color: '#f00' },
    }
    nodeTypeAccessor?: (node: Node) => string | undefined

    Function to access the type of a node. Used in

    Used to style nodes based on their type.

    Used in conjuction with nodeStyleMap

    nodeTypeAccessor: (node) => node.getData()?.type
    
    renderCluster?: (cluster: Node) => string | void | HTMLElement

    Custom renderer for clusters.

    Allows full control over how a cluster is displayed The function can return either:

    • An HTMLElement to be used as the cluster, or
    • A string to render inside the cluster
    renderCluster: (cluster: Node): HTMLElement | string | void => {
    const size = 12;
    const style = [
    'display:block',
    `width:${size}px`,
    `height:${size}px`,
    'background-color:#907acc',
    'border: 2px solid #fff',
    'border-radius:50%',
    'opacity: 1',
    ].join(';');

    return `<span style="${style}"></span>`;
    }
    renderLabel?: (edge: Edge) => string | void | HTMLElement

    Custom renderer for edge labels.

    Allows full control over how edge labels are displayed. The function can return either:

    • An HTMLElement to be used as the edge's label, or
    • A string to render inside the label
    renderLabel: (edge: Edge): HTMLElement | string | void => {
    const style = [
    'display:inline-block',
    'background-color:#907acc',
    'border: 2px solid #fff',
    'border-radius:50%',
    'opacity: 1',
    ].join(';');

    const text = edge.getData().label;
    return `<span style="${style}">${text}</span>`;
    }
    renderNode?: (node: Node) => string | void | HTMLElement

    Custom renderer for nodes.

    Allows full control over how a node is displayed The function can return either:

    • An HTMLElement to be used as the node,
    • A string to render inside the node, or
    • nothing, to leave that node to the normal styling pipeline

    A card returned here is the node: no shape, icon, picture or label is drawn behind it, and its measured size drives the collision radius and edge anchors. Returning nothing for a node instead gives it its nodeStyleMap entry, shape and label as usual — so this can card a few nodes rather than all of them.

    For a card that composes with the rest of the styling chain, declare NodeStyle.html with shape: 'none' instead; it resolves per type or per node, where this one is global.

    renderNode: (node: Node): HTMLElement | string | void => {
    const size = 12;
    const style = [
    'display:block',
    `width:${size}px`,
    `height:${size}px`,
    'background-color:#907acc',
    'border: 2px solid #fff',
    'border-radius:50%',
    'opacity: 1',
    ].join(';');

    return `<span style="${style}"></span>`;
    }
    selectionBox: SelectionBox

    Defines the rendering method used by the graph.

    zoomAnimation: boolean
    true
    
    zoomAnimationDuration: number
    300
    
    zoomEnabled: boolean
    true