Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix(chart): Fixes an issue where tooltipDataChange event did not carr…
Browse files Browse the repository at this point in the history
…y tooltip data.
  • Loading branch information
tomheller committed Jan 25, 2021
1 parent 37402ff commit d482ef5
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions libs/barista-components/chart/src/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,11 @@ export class DtChart
* Eventemitter that fires every time the data inside the chart tooltip changes
*/
@Output()
readonly tooltipDataChange: EventEmitter<
DtChartTooltipEvent
> = new EventEmitter();
readonly tooltipDataChange: EventEmitter<DtChartTooltipEvent> = new EventEmitter();

/** Eventemitter that fires every time a legend item is clicked and a series visibility changes */
@Output()
readonly seriesVisibilityChange = new EventEmitter<
DtChartSeriesVisibilityChangeEvent
>();
readonly seriesVisibilityChange = new EventEmitter<DtChartSeriesVisibilityChangeEvent>();

/** returns an array of ids for the series data */
get seriesIds(): Array<string | undefined> | undefined {
Expand Down Expand Up @@ -359,20 +355,20 @@ export class DtChart
);
}

private readonly _heatfieldActiveChanges: Observable<
DtChartHeatfieldActiveChange
> = defer(() => {
if (this._heatfields) {
return merge<DtChartHeatfieldActiveChange>(
...this._heatfields.map((heatfield) => heatfield.activeChange),
);
}
private readonly _heatfieldActiveChanges: Observable<DtChartHeatfieldActiveChange> = defer(
() => {
if (this._heatfields) {
return merge<DtChartHeatfieldActiveChange>(
...this._heatfields.map((heatfield) => heatfield.activeChange),
);
}

return this._ngZone.onStable.asObservable().pipe(
take(1),
switchMap(() => this._heatfieldActiveChanges),
);
});
return this._ngZone.onStable.asObservable().pipe(
take(1),
switchMap(() => this._heatfieldActiveChanges),
);
},
);

constructor(
private _changeDetectorRef: ChangeDetectorRef,
Expand Down Expand Up @@ -611,7 +607,11 @@ export class DtChart
this,
plotBackgroundInfo,
);
this.tooltipDataChange.emit();
state.event?.data
? this.tooltipDataChange.emit({
data: state.event?.data,
})
: this.tooltipDataChange.emit();
break;
}
});
Expand Down Expand Up @@ -669,9 +669,9 @@ export class DtChart
private _notifyAfterRender(): void {
this._ngZone.runOutsideAngular(() => {
this._afterRender.next();
const plotBackground = this._container.nativeElement.querySelector<
SVGRectElement
>(HIGHCHARTS_PLOT_BACKGROUND);
const plotBackground = this._container.nativeElement.querySelector<SVGRectElement>(
HIGHCHARTS_PLOT_BACKGROUND,
);

// set the offset of the plotBackground in relation to the chart
this._setPlotBackgroundOffset(plotBackground);
Expand Down

1 comment on commit d482ef5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for design-tokens-ui ready!

✅ Preview
https://design-tokens-ui-33u00jou8.vercel.app

Built with commit d482ef5.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.