Recompute Y Axis on data change (#15381)

This commit is contained in:
Phil Renaud
2022-11-28 09:56:47 -05:00
committed by GitHub
parent 2d83ce7b15
commit 6a1419252f
2 changed files with 8 additions and 0 deletions

View File

@@ -357,6 +357,13 @@ export default class LineChart extends Component {
}
}
@action
recomputeYAxis(el) {
if (!this.isDestroyed && !this.isDestroying) {
d3.select(el.querySelector('.y-axis')).call(this.yAxis);
}
}
mountD3Elements() {
if (!this.isDestroyed && !this.isDestroying) {
d3.select(this.element.querySelector('.x-axis')).call(this.xAxis);

View File

@@ -4,6 +4,7 @@
{{did-insert this.onInsert}}
{{did-update this.renderChart}}
{{did-update this.recomputeXAxis this.xScale}}
{{did-update this.recomputeYAxis this.yScale}}
{{window-resize this.updateDimensions}}>
<svg data-test-line-chart aria-labelledby="{{this.titleId}}" aria-describedby="{{this.descriptionId}}">
<title id="{{this.titleId}}">{{this.title}}</title>