Skip to content

Commit

Permalink
fix: fix bar chart tooltip data (carbon-design-system#692)
Browse files Browse the repository at this point in the history
Co-authored-by: Fei <[email protected]>
  • Loading branch information
2 people authored and linhenry0417 committed Jul 23, 2020
1 parent b8d7ecf commit ea3ad71
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/src/components/essentials/tooltip-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,15 @@ export class TooltipBar extends Tooltip {
return `<div class="axis-tooltip"><p class="label">${data}</p></div>`;
}

const rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();

const formattedValue = Tools.getProperty(
this.model.getOptions(),
"tooltip",
"valueFormatter"
)
? this.model.getOptions().tooltip.valueFormatter(data.value)
: data.value.toLocaleString("en");
: data[rangeIdentifier].toLocaleString("en");

return `<div class="datapoint-tooltip"><p class="value">${formattedValue}</p></div>`;
}
Expand Down

0 comments on commit ea3ad71

Please sign in to comment.