Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ui] Line charts: explicitly update X-axis whenever xScale changes #14814

Merged
merged 2 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ui/app/components/line-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,13 @@ export default class LineChart extends Component {
});
}

@action
recomputeXAxis(el) {
if (!this.isDestroyed && !this.isDestroying) {
d3.select(el.querySelector('.x-axis')).call(this.xAxis);
}
}

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 @@ -3,6 +3,7 @@
...attributes
{{did-insert this.onInsert}}
{{did-update this.renderChart}}
{{did-update this.recomputeXAxis this.xScale}}
{{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