PieEventTexts
Name: Pie Event Texts
Description: Suitable for use with
Pie
, displays event (mouse over) information
params$
Type:
Partial<PieEventTextsParams>
Fields:
Name Description Type renderFn Function to display text, if the return value is an array, it will be displayed as multi-line text (d: EventSeries) => string[] | string
textAttrs Attributes for each line of text Array<{ [key:string]: string | number }>
textStyles Styles for each line of text Array<{ [key:string]: string | number }>
Default values:
{
renderFn: (eventData: EventSeries) => {
if (eventData.eventName === 'mouseover' || eventData.eventName === 'mousemove') {
return [String(eventData.datum!.value)]
}
return [
String(
Math.round(
eventData.data.reduce((acc, seriesData) => {
return acc + seriesData.reduce((_acc, data) => {
return _acc + (data.value ?? 0)
}, 0)
}, 0) * (eventData.tween ?? 1)
)
)
]
},
textAttrs: [
{
"transform": "translate(0, 0)"
}
],
textStyles: [
{
"font-weight": "bold",
"text-anchor": "middle",
"pointer-events": "none",
"dominant-baseline": "middle",
"font-size": 64,
"fill": "#000"
}
]
}