esnet / esnet/react-timeseries-charts

Tracker displays timestamps not in the X axis's range

Open
#182 0 comments 0 reactions 0 assignees View on GitHub
:spider: bug
Dominant language
JavaScript
Stars
876
Forks
279
PR merge metrics
No merged PRs in 30d

Description

The width of any Y Axes seems to be appended to the beginning of the available time range for the tracker. This results in the tracker displaying a timestamp that does not exist in the dataset, with the values from the next valid item in the TimeSeries.

---

I feel like that explanation is pretty unclear, so I'm also [attaching a zip file](https://github.com/esnet/react-timeseries-charts/files/1300423/misleading.x.axis.results.zip) containing an example screen recording with two Y Axes (in which the problem is even more pronounced).

In this example video, you can see the timestamp at the left-side of the chart of 9:38:31, which is the one associated with my first piece of data. Then, as I hover between the axes and over the labels, it continues to display timestamps before that, but with the data from the first "real" value.

This behavior is a problem because someone might see the lower timestamp (which is not actually in the dataset), and assume the data displayed (for the first valid timestamp) is associated with that time. That perception error seems especially possible if the chart is zoomed and panned, where the user knows there _might_ be more data off to the side, but they're actually already panned to the limit.

---

I "fixed" it in my code by wrapping my tracker code with a check to make sure it's within the bounds of the x axis:
```
onTrackerChanged = _.throttle((tracker) => {
// xAxisTimeRange is ChartContainer's 'timeRange' prop
const xRange = this.state.xAxisTimeRange;
// Only re-render with new tracker data if it's within the X axis limits
if (tracker && tracker > xRange.begin() && tracker < xRange.end()) {
this.setState({tracker});
this.updateInfoBox(tracker);
}
}, 10);
```

but I think it's possible that this behavior of fabricated timestamps is never desired, especially since the tracker seems to be intentionally removed when hovering over the yAxis, just not when hovering between yAxes or over an axis's labels.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.