Skip to content

Commit

Permalink
Recompute Y Axis on data change
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Nov 24, 2022
1 parent 8018dd0 commit 8fc9a69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ui/app/components/line-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions ui/app/templates/components/line-chart.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 8fc9a69

Please sign in to comment.