Skip to content

Commit

Permalink
fix: Ranged plot tooltip values are not shown properly #1473 (#1486)
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-mihok authored Jun 7, 2022
1 parent 808f79c commit f8d19a3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ui/src/plot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,12 @@ const PlotTooltip = ({ items }: { items: TooltipItem[] }) =>
<span style={{ backgroundColor: mappingData?.color || color }} className="g2-tooltip-marker" />
<span style={{ display: 'inline-flex', flex: 1, justifyContent: 'space-between' }}>
<span style={{ marginRight: 16 }}>{item}:</span>
<span>{data[item] instanceof Date ? data[item].toISOString().split('T')[0] : data[item]}</span>
<span>
{(Array.isArray(data[item]) ? data[item] : [data[item]]).map((val: any, idx: number) => {
const value = val instanceof Date ? val.toISOString().split('T')[0] : val
return idx > 0 ? ` - ${value}` : value
})}
</span>
</span>
</li>
)
Expand Down

0 comments on commit f8d19a3

Please sign in to comment.