patternfly / patternfly/patternfly-react
Bug - Tooltips on Charts - Tooltips for non-Latin character code pages are too narrow
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 862
- Forks
- 392
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 9
Description
Describe the problem
By default the @patternfly/react-charts chart tooltips use the same text width estimation as is used in the Victory charts. This estimation works ok for ASCII characters, but underestimate sizes for other non-Latin character code pages.
How do you reproduce the problem?
Have a chart tooltip is any non-Latin character language. Japanese is a good example.
Expected behavior
The tooltips for Latin character languages have their text's width estimated well, but for non-Latin character language (such as Japanese), the text width is vastly underestimated.
Is this issue blocking you?
No, but could be very common in non-Latin languages. It was first detected in a Japanese translation.
The workaround used was to force the tooltip to a constant width wide enough to display the tooltip in every translation.
For example, in (https://github.com/oVirt/ovirt-engine-ui-extensions/blob/0642c73c45dc084bd841e1928884dd1fa61bb0b0/src/components/patternfly/DonutChart.js#L40-L52), the ChartTooltip's flyoutWidth is set to a constant value:
<ChartDonutUtilization
title={donutChartText}
subTitle={donutChartSubtitle}
themeColor={ChartThemeColor.green}
labelComponent={<ChartTooltip flyoutWidth={180} />}
data={{ x: 'Capacity', y: percentUsed * 100 }}
labels={({ datum }) => datum.x ? usedLabel : availableLabel}
thresholds={colors}
events={[{ target: 'data', eventHandlers: { onClick: onDataClick } }]}
height={200}
width={200}
padding={{ top: 15 }}
/>
Screenshots
Example 1:

Example 2:

What is your environment?
- OS: Any
- Browser: Any
- Version:
"@patternfly/react-charts": "^6.74.3"
What is your product and what release date are you targeting?
oVirt
Any other information?
See:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the @patternfly/react-charts ChartTooltip entry point and inspect how its flyout text width is estimated from the Victory charts behavior. Reproduce the issue with Japanese or another non-Latin translation, using the reported flyoutWidth workaround as a comparison. Done means tooltip text is no longer substantially underestimated for non-Latin languages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, internationalization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100