Skip to content

Commit

Permalink
fix: fixed tooltip render on pin with empty data (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
zefirka authored Nov 8, 2023
1 parent c615d33 commit 52a0847
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/YagrCore/plugins/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,15 @@ class YagrTooltip {
x,
};

const hasDataNow = Object.values(sections).some(
({rows}) => rows.filter(({id}) => this.yagr.getSeriesById(id)?.show).length > 0,
);

if (!hasDataNow) {
this.hide();
return;
}

if (!opts.virtual) {
this.tOverlay.innerHTML = opts.render({
...renderData,
Expand Down
1 change: 1 addition & 0 deletions src/YagrCore/utils/series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export function configureSeries(yagr: Yagr, rawSeries: RawSerieData, idx: number

export const overrideSeriesInUpdate = (dest: Series, source: Series) => {
dest.$c = source.$c ?? dest.$c;
dest.show = source.show ?? dest.show;
dest.data = source.data ?? dest.data;
dest.width = source.width ?? dest.width;
dest.pointsSize = source.pointsSize ?? dest.pointsSize;
Expand Down

0 comments on commit 52a0847

Please sign in to comment.