How to use the labella.Renderer function in labella

To help you get started, we’ve selected a few labella examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kristw / d3kit-timeline / src / main.js View on Github external
drawLabels(nodes, labelTextStyle) {
    const options = this.options();
    let nodeHeight;
    if(options.direction==='left' || options.direction==='right'){
      nodeHeight = max(nodes, rectWidth);
    }
    else{
      nodeHeight = max(nodes, rectHeight);
    }

    const renderer = new labella.Renderer({
      nodeHeight,
      layerGap: options.layerGap,
      direction: options.direction
    });

    renderer.layout(nodes);

    function nodePos(d){
      switch(options.direction){
        case 'right':
          return 'translate('+(d.x)+','+(d.y-d.dy/2)+')';
        case 'left':
          return 'translate('+(d.x + nodeHeight - d.w)+','+(d.y-d.dy/2)+')';
        case 'up':
          return 'translate('+(d.x-d.dx/2)+','+(d.y)+')';
        case 'down':

labella

May the force label you.

Apache-2.0
Latest version published 7 years ago

Package Health Score

56 / 100
Full package analysis