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

text.annotation-note-label overlaps text.annotation-note-title (rather than offsetting) #72

Open
kortina opened this issue Oct 15, 2020 · 0 comments

Comments

@kortina
Copy link

kortina commented Oct 15, 2020

Hi, tx for making this great library. It seems fairly straightforward to use, but I am having an issue trying to follow the basic examples where the text.annotation-note-label just renders in the same position as text.annotation-note-title (rather than below it on the y-axis as show in the example).

Here is the full code:

https://observablehq.com/@kortina/wall-st-vs-main-st

And relevant snippet:

const annotations = [
    {
    note: { title: "2008 Financial Crisis", label: "Unemploymentꜛ  S&P500 ꜜ" },
    x: x(new Date(2008, 4)), 
    y: yLeft(0.09),
    dy: 100,
    dx: -150
  },
  {
    note: { title: "COVID-19" },
    x: x(new Date(2020, 2)), 
    y: yLeft(0.07),
    dy: 50,
    dx: -150
  }
]

const makeAnnotations = d3.annotation()
  .editMode(false)
  .notePadding(0)
  .type(d3.annotationCalloutCircle)
  .annotations(annotations)
  
  svg
  .append("g")
  .attr("class", "annotation-group")
  .attr("clip-path", clipId) // uncomment to animate annotation
  .call(makeAnnotations)
  

}

Am I doing something silly here? Or do I need to add some extra custom css to get the label to offset by the correct y amount to render below the title?

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

1 participant