diff --git a/.changelog/14814.txt b/.changelog/14814.txt new file mode 100644 index 000000000000..b26610208488 --- /dev/null +++ b/.changelog/14814.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Fixed line charts to update x-axis (time) where relevant +``` diff --git a/ui/app/components/line-chart.js b/ui/app/components/line-chart.js index c9a119b75817..5acf3f94e061 100644 --- a/ui/app/components/line-chart.js +++ b/ui/app/components/line-chart.js @@ -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); diff --git a/ui/app/templates/components/line-chart.hbs b/ui/app/templates/components/line-chart.hbs index 7927fe2c6899..f669bd2023a6 100644 --- a/ui/app/templates/components/line-chart.hbs +++ b/ui/app/templates/components/line-chart.hbs @@ -3,6 +3,7 @@ ...attributes {{did-insert this.onInsert}} {{did-update this.renderChart}} + {{did-update this.recomputeXAxis this.xScale}} {{window-resize this.updateDimensions}}> {{this.title}}