Skip to content

Commit

Permalink
fix(placeholder): replace placeholder inside piechart
Browse files Browse the repository at this point in the history
  • Loading branch information
willian-viana committed Nov 13, 2024
1 parent a7c25a7 commit 0b9ed47
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/charts/components/pie-chart-legend/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,20 @@ class PieChartLegend extends PureComponent {
>
<ul className={cx({ simple, sizeClass })}>
{data.map((item, index) => {
const PLACEHOLDER = new RegExp(`\\bPLACEHOLDER\\b`, 'g');
const label = item.label.replace(PLACEHOLDER, `and`);
const value = `${formatNumber({
num: item[config.key],
unit: item.unit ? item.unit : config.unit,
spaceUnit: item.unit !== '%' && config.unit !== 'countsK',
})}`;

return (
<li className="legend-item" key={index.toString()}>
<div className="legend-title">
<span style={{ backgroundColor: item.color }}>{}</span>
<p>
{item.label}
{label}
{sizeClass === 'x-small' && `- ${value}`}
</p>
</div>
Expand Down

0 comments on commit 0b9ed47

Please sign in to comment.