dosubot[bot] commented on issue #31864:
URL: https://github.com/apache/superset/issues/31864#issuecomment-2592230306
<!-- Answer -->
To display the full name on hover in the latest e-charts based bar-chart in
Superset, you can customize the `tooltipFormatter` function in the
`transformProps` function. This function is responsible for formatting the
tooltip content. You can modify it to include the full name or any additional
information you want to display.
Here's an example of how you might adjust the `tooltipFormatter`:
```ts
const tooltipFormatter = (params: CallbackDataParams[]) => {
const title = params[0].name;
const rows = params.map(param => {
const { marker, seriesName, value, data } = param;
const fullName = data.fullName; // Assuming fullName is a field in
your data
return [
`${marker}${seriesName}`,
formatter.format(value as number),
`Full Name: ${fullName}` // Include the full name in the tooltip
];
});
if (groupby.length > 0) {
const total = params.reduce(
(acc, param) => acc + (param.value as number),
0,
);
if (!normalize) {
rows.forEach((row, i) =>
row.push(
percentFormatter.format((params[i].value as number) / (total ||
1)),
),
);
}
const totalRow = ['Total', formatter.format(total)];
if (!normalize) {
totalRow.push(percentFormatter.format(1));
}
rows.push(totalRow);
}
return tooltipHtml(rows, title, focusedSeries);
};
```
In this example, `fullName` is assumed to be a property of the `data` object
within each `param`. You would replace `fullName` with the actual field name
you want to include in the tooltip
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-echarts/src/Histogram/transformProps.ts)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
---
<sup>Help Dosu learn! Give it feedback: [Great
Response](https://app.dosu.dev/response-feedback/5ed2baf0-6036-4e39-be94-3f36626ccf09?feedback_type=great_response)
| [Irrelevant
Answer](https://app.dosu.dev/response-feedback/5ed2baf0-6036-4e39-be94-3f36626ccf09?feedback_type=irrelevant_answer)
| [Incorrect
Sources](https://app.dosu.dev/response-feedback/5ed2baf0-6036-4e39-be94-3f36626ccf09?feedback_type=incorrect_sources)
| [Too
Verbose](https://app.dosu.dev/response-feedback/5ed2baf0-6036-4e39-be94-3f36626ccf09?feedback_type=too_verbose)
|
[Hallucination](https://app.dosu.dev/response-feedback/5ed2baf0-6036-4e39-be94-3f36626ccf09?feedback_type=hallucination)
|
[Other](https://app.dosu.dev/response-feedback/5ed2baf0-6036-4e39-be94-3f36626ccf09?feedback_type=other)</sup>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]