mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
feat: Utility function to render chart tooltips (#27950)
This commit is contained in:
committed by
GitHub
parent
467e612533
commit
b549977f05
@@ -16,7 +16,11 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { getMetricLabel, DataRecordValue } from '@superset-ui/core';
|
||||
import {
|
||||
getMetricLabel,
|
||||
DataRecordValue,
|
||||
tooltipHtml,
|
||||
} from '@superset-ui/core';
|
||||
import { EChartsCoreOption, TreeSeriesOption } from 'echarts';
|
||||
import {
|
||||
TreeSeriesCallbackDataParams,
|
||||
@@ -44,11 +48,8 @@ export function formatTooltip({
|
||||
const treePath = (treeAncestors ?? [])
|
||||
.map(pathInfo => pathInfo?.name || '')
|
||||
.filter(path => path !== '');
|
||||
|
||||
return [
|
||||
`<div>${treePath.join(' ▸ ')}</div>`,
|
||||
value ? `${metricLabel}: ${value}` : '',
|
||||
].join('');
|
||||
const row = value ? [metricLabel, String(value)] : [];
|
||||
return tooltipHtml([row], treePath.join(' ▸ '));
|
||||
}
|
||||
|
||||
export default function transformProps(
|
||||
|
||||
Reference in New Issue
Block a user