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

Chart tooltip disappearing when new data arrives. #1410

Closed
TannerGilbert opened this issue Jul 31, 2020 · 3 comments
Closed

Chart tooltip disappearing when new data arrives. #1410

TannerGilbert opened this issue Jul 31, 2020 · 3 comments
Labels
bug A broken behaviour that was working previously help wanted Extra attention is needed

Comments

@TannerGilbert
Copy link

Bug Report

Expected Behavior

Chart tooltip should update, when new values are received.

Current Behavior

Tooltip values are being removed but new values aren't added.

Steps to Reproduce

Used Versions:

  • typescript: 3.8.3
  • @angular/cdk: 9.2.4
  • @dynatrace/barista-components: 7.6.0

Attachments

barista_tooltip_disappearing2

barista_tooltip_disappearing

@TannerGilbert TannerGilbert added the bug A broken behaviour that was working previously label Jul 31, 2020
@tomheller
Copy link
Collaborator

@TannerGilbert Thank you for reporting this. This definitely seems like a bug.

I already have a guess that we are not getting a new seriesHover event from highcharts, and therefor do not update the implicit context of the overlay.

@tomheller tomheller added the help wanted Extra attention is needed label Aug 3, 2020
@tomheller
Copy link
Collaborator

As expected, highcharts does not send a new tooptipUpdated event, if the mouse does not move.
If you have a look at the highcharts dynamic chart example 1, if you hover over a data point and do not move the mouse, the tooltip moves with the set datapoint.

My current approach to solve this, would be to see if we can either:

  • Get the hovered series data from highcharts, when the data changes and fake the tooltip data in manually.
  • Dispatch a fake mouse event to force highcharts to refire the tooltipUpdated event.

@ffriedl89 ffriedl89 added this to the Sprint 201 milestone Aug 3, 2020
@tomheller
Copy link
Collaborator

tomheller commented Aug 3, 2020

This seems more and more like something that cannot be fixed. At least not in the way highcharts is currently wrapped into the dt-chart.

When the series data is being set, the charts update function is called:

if (series instanceof Observable) {
this._dataSub = series.subscribe((s: DtChartSeries[]) => {
this._currentSeries = s;
this._update();
});

In this update function, we need to destroy the current chart object and reinstantiate it again. Highcharts has an update function, although this will not let the consumer update all properties of the series or chart options. This has been leading to problems in the past, which is why we implemented the re-instantiation functionality in 6df1df8.

Before the change, the update function looked like this, where the new series and options were passed to the Highcharts.update function.

private _updateChart(xAxisHasChanged: boolean): void {
if (this._chartObject) {
this._ngZone.runOutsideAngular(() => {
if (xAxisHasChanged) {
this._chartObject!.update({ series: [] }, false, true);
}
this._chartObject!.update({ ...this._highchartsOptions }, true, true);
});
this.updated.emit();
}
}

I currently do not see a good way to solve this issue without reintroducing old problems. Any input would be appreciated @ffriedl89 @lukasholzer.


The same root cause applies to issue #1412.

@tomheller tomheller added the P4 Low-priority issue that needs to be resolved label Aug 4, 2020
@lukasholzer lukasholzer removed the P4 Low-priority issue that needs to be resolved label Sep 7, 2020
@lukasholzer lukasholzer removed this from the Sprint 201 milestone Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A broken behaviour that was working previously help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants