Skip to content

Commit

Permalink
ui: fix time window selection with mouse on Metrics charts
Browse files Browse the repository at this point in the history
This patch fixes an issue that prevents proper time selection
with mouse on Metrics charts. The root cause of it is
updated time scale object didn't include correct value
of `windowSize` that's used to calculate `start` position
of time range.

Release note (ui change): fix issue with incorrect start time
position of selected time range on Metrics page.
  • Loading branch information
koorosh committed Aug 9, 2022
1 parent 40d59b5 commit d46ba25
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,11 @@ export class LineGraph extends React.Component<LineGraphProps, {}> {
start: moment.unix(start),
end: moment.unix(end),
};
const seconds = moment.duration(moment.utc(end).diff(start)).asSeconds();
let newTimeScale: TimeScale = {
...findClosestTimeScale(defaultTimeScaleOptions, end - start, start),
...findClosestTimeScale(defaultTimeScaleOptions, seconds),
key: "Custom",
windowSize: moment.duration(moment.unix(end).diff(moment.unix(start))),
fixedWindowEnd: moment.unix(end),
};
if (this.props.adjustTimeScaleOnChange) {
Expand Down

0 comments on commit d46ba25

Please sign in to comment.