Skip to content
This repository was archived by the owner on Nov 14, 2023. It is now read-only.

Commit f9b9cba

Browse files
itssharmasandeepjaywalker21
authored andcommitted
fix: grouped legend bug (hypertrace#1334)
1 parent 3329648 commit f9b9cba

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

projects/observability/src/shared/components/cartesian/d3/legend/cartesian-legend.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ComponentRef, Injector } from '@angular/core';
22
import { Color, Dictionary, DynamicComponentService } from '@hypertrace/common';
33
import { ContainerElement, EnterElement, select, Selection } from 'd3-selection';
4-
import { groupBy } from 'lodash-es';
4+
import { groupBy, isEmpty } from 'lodash-es';
55
import { Observable, Subject } from 'rxjs';
66
import { startWith } from 'rxjs/operators';
77
import { LegendPosition } from '../../../legend/legend.component';
@@ -41,7 +41,8 @@ export class CartesianLegend<TData> {
4141
private readonly summaries: Summary[] = []
4242
) {
4343
this.isGrouped =
44-
this.series.length > 0 && this.series.every(seriesEntry => seriesEntry.groupName !== seriesEntry.name);
44+
this.series.length > 0 &&
45+
this.series.every(seriesEntry => !isEmpty(seriesEntry.groupName) && seriesEntry.groupName !== seriesEntry.name);
4546
this.groupedSeries = this.isGrouped ? groupBy(this.series, seriesEntry => seriesEntry.groupName) : {};
4647

4748
this.activeSeries = [...this.series];

0 commit comments

Comments
 (0)