Skip to content

Commit

Permalink
Fix annotation update on 1.x branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciopoppe committed Nov 2, 2024
1 parent c27f9fa commit 67c125c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/helpers/annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export default function annotations(options: { owner: Chart }) {
return [[[xRange[0], 0], [xRange[1], 0]]]
}
})
const pathEnter = path.enter().append('path')
path
.enter()
.append('path')
.merge(pathEnter)
.attr('stroke', '#eee')
.attr('d', line as any)
path.exit().remove()
Expand All @@ -61,9 +61,13 @@ export default function annotations(options: { owner: Chart }) {
}
]
})
const textEnter = text.enter().append('text')

text
.enter()
.append('text')
.merge(textEnter)
.text(function (d) {
return d.text
})
.attr('y', function (d) {
return d.hasX ? 3 : 0
})
Expand All @@ -79,9 +83,6 @@ export default function annotations(options: { owner: Chart }) {
.attr('transform', function (d) {
return d.hasX ? 'rotate(-90)' : ''
})
.text(function (d) {
return d.text
})
text.exit().remove()

// enter + update
Expand Down

0 comments on commit 67c125c

Please sign in to comment.