Skip to content

Defining a RectAnnotation as outside has not affect #2470

Closed
@nickofthyme

Description

@nickofthyme

Describe the issue
If a RectAnnotation is defined without using a groupId the outside prop has no affect.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/p/sandbox/quizzical-saha-s8k5p2?file=%2Fsrc%2FApp.tsx%3A38%2C28
  2. Comment/uncomment the groupId on the RectAnnotation spec
  3. Notice the annotation is not rendered as outside annotation when groupId is missing

Expected behaviour
The RectAnnotation is always rendered on the outside of the chart when the outside prop is set to true.

Screenshots
image

Version (please complete the following information):
I think this issue is original to the outside feature added in #1207

Additional context
The code has a break branch from #842 to render annotations when we have no yScale.

This is the path taken when a groupId is applied. But when a yScale is defined, it renders the outside only if x0 and x1 where initially undefined, this is the problem!

...(!isDefined(initialX0) && !isDefined(initialX1) && outside
? {
x: isLeftSide ? -outsideDim : orthoDimension,
width: outsideDim,
}
: xAndWidth),

Metadata

Metadata

Assignees

Labels

:annotationAnnotation (line, rect, text) related issuebugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions