Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Labels not appearing.. #89

Open
krs-world opened this issue Feb 26, 2024 · 1 comment
Open

Labels not appearing.. #89

krs-world opened this issue Feb 26, 2024 · 1 comment
Assignees

Comments

@krs-world
Copy link
Contributor

Hitting the 'l' button used to bring up the labels in the BRIDGES visualization. This doesnt seem to be working.

@esaule
Copy link
Member

esaule commented Jun 26, 2024

So there is a difference in the code between the graph SVG backend and the graph canvas backend. They seem to be using different logic to decide whether to draw the labels or not.

here is the graph-canvas.js logic:

    // draw text labels with line breaks
    function drawText(d) {
      if(BridgesVisualizer.showingNodeLabels || d.hovering) {
        context.fillStyle = "black";
        d.lines.forEach(function(line, i) {
          context.fillText(line, d.x+10, d.y+(i*10)+3);
        });
      }
    }

    // draw text labels with line breaks
    function drawLinkText(d, anchor) {
      if((BridgesVisualizer.showingLinkLabels || d.hovering) && d.lines && d.lines.length > 0 ) {
        d.lines.forEach(function(line, i) {
          context.fillStyle = "black";
          context.fillText(line, anchor.x, anchor.y+(i*10));
          context.fillStyle = BridgesVisualizer.getColor(d.color);
        });
      }
    }

See how that uses BridgesVisualize.showingLinkLabels. (BTW doesn't that code ignore color?)

The svg backend uses:

  if(BridgesVisualizer.labels_shown === true){
    d3.selectAll(".nodeLabel").each(BridgesVisualizer.displayNodeLabels)
  }
  if(BridgesVisualizer.link_labels_shown === true){
    d3.selectAll(".linkLabel").each(BridgesVisualizer.displayLinkLabels)
  }

notice how that uses BridgesVisualizer.labels_shown and BridgesVisualizer.link_labels_shown

@esaule esaule assigned esaule and unassigned quaiquai Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants