d3-annotation icon indicating copy to clipboard operation
d3-annotation copied to clipboard

Custom orientation being overridden

Open jjsiman opened this issue 5 years ago • 3 comments

Not sure if I am not understanding the code properly or made my own mistake, but when I try to add a custom orientation into the note it has no effect. Basically what I want to do is have an annotation with a connector that is angled down and text above the horizontal line. Looking at the repo I see line 1480 of d3-annotation.js:

if (lineType === "vertical") orientation = "leftRight";else if (lineType === "horizontal") orientation = "topBottom";

It seems to me that custom orientation could be getting ignored because of lineType. Please correct me if I'm wrong!

jjsiman avatar Apr 02 '19 15:04 jjsiman

@jjsiman yes this is correct. In general I would have to say that the combination of orientation / lineType / align overall is overly confusing in its current form but yes orientation is overridden if you have a lineType. What is the desired behavior you're looking for?

Have you tried opening the options pane to play around with some of the options? image

susielu avatar Apr 07 '19 19:04 susielu

@susielu Thanks for the response! I wasn't able to get my desired behavior with the options, but essentially I was trying to have a callout elbow that is angled down with the text above the horizontal line. I've attached a quick sketch. IMG_1997

jjsiman avatar Apr 08 '19 16:04 jjsiman

Ah thanks for posting this example, yes unfortunately I think the annotation tries to "helpfully" move the text to the bottom below the line if you callout is under the point you're interested.

susielu avatar May 10 '19 19:05 susielu