Skip to content

Commit e3a492f

Browse files
committed
fix: aggregate value tooltip
1 parent a131ee2 commit e3a492f

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

packages/shared/charts/src/utils/__tests__/aggregations.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe("aggregateDataPoints", () => {
3434

3535
expect(result.x).toEqual(["A", "B", "C"]);
3636
expect(result.y).toEqual([25, 45, 30]);
37-
expect(result.hovertext).toEqual(["SUM: 25 (2 values)", "SUM: 45 (2 values)", "hover4"]);
37+
expect(result.hovertext).toEqual(["25", "45", "hover4"]);
3838
});
3939

4040
it("should preserve original hover text for single values", () => {

packages/shared/charts/src/utils/aggregations.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ export function aggregateDataPoints(
5555
const aggregatedValue = computeAggregate(yVals, aggregationType);
5656
aggregatedY.push(aggregatedValue);
5757

58-
const aggregatedHoverText =
59-
yVals.length > 1
60-
? `${aggregationType.toUpperCase()}: ${aggregatedValue} (${yVals.length} values)`
61-
: hoverTexts[0];
58+
const aggregatedHoverText = yVals.length > 1 ? aggregatedValue.toLocaleString() : hoverTexts[0];
6259

6360
aggregatedHover.push(aggregatedHoverText);
6461
}

0 commit comments

Comments
 (0)