@ssa-ui-kit/core 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/SegmentedPieChart/SegmentedPieChart.d.ts +1 -1
- package/dist/components/SegmentedPieChart/SegmentedPieChartContext.d.ts +13 -0
- package/dist/components/SegmentedPieChart/components/ChartTitle.d.ts +1 -4
- package/dist/components/SegmentedPieChart/components/ChartTooltip.d.ts +1 -2
- package/dist/components/SegmentedPieChart/components/LegendItem.d.ts +1 -1
- package/dist/components/SegmentedPieChart/types.d.ts +13 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AccordionGroup/stories/AccordionGroup.stories.tsx +1 -1
- package/src/components/PieChart/PieChartBases.tsx +5 -5
- package/src/components/SegmentedPieChart/SegmentedPieChart.tsx +57 -52
- package/src/components/SegmentedPieChart/SegmentedPieChartContext.tsx +58 -0
- package/src/components/SegmentedPieChart/components/ChartTitle.tsx +84 -27
- package/src/components/SegmentedPieChart/components/ChartTooltip.tsx +8 -6
- package/src/components/SegmentedPieChart/components/LegendItem.tsx +8 -5
- package/src/components/SegmentedPieChart/hooks/useData.ts +8 -4
- package/src/components/SegmentedPieChart/stories/SegmentedPieChart.stories.tsx +23 -0
- package/src/components/SegmentedPieChart/types.ts +14 -8
- package/tsbuildcache +1 -1
- package/webpack.config.js +1 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { css, useTheme } from '@emotion/react';
|
|
1
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
3
|
import { AccordionGroup } from '../index';
|
|
3
4
|
import { AccordionGroupDecorator } from './helpers';
|
|
4
|
-
import { css, useTheme } from '@emotion/react';
|
|
5
5
|
import { AccordionTemplate } from './helpers';
|
|
6
6
|
|
|
7
7
|
type Args = StoryObj<typeof AccordionGroup>;
|
|
@@ -15,13 +15,13 @@ export const PieChartBase = styled.div`
|
|
|
15
15
|
|
|
16
16
|
export const PieChartTextBase = styled.div`
|
|
17
17
|
position: absolute;
|
|
18
|
-
width: 100%;
|
|
19
|
-
height: 100%;
|
|
20
|
-
pointer-events: none;
|
|
21
|
-
top: 0;
|
|
22
|
-
left: 0;
|
|
23
18
|
display: flex;
|
|
24
19
|
align-items: center;
|
|
25
20
|
justify-content: center;
|
|
26
21
|
text-align: center;
|
|
22
|
+
width: calc(100% - 34px);
|
|
23
|
+
height: calc(100% - 34px);
|
|
24
|
+
left: 17px;
|
|
25
|
+
top: 17px;
|
|
26
|
+
border-radius: 50%;
|
|
27
27
|
`;
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import { SegmentedPieChartProps } from './types';
|
|
8
8
|
import { ChartTitle, ChartTooltip, LegendItem } from './components';
|
|
9
9
|
import { useData } from './hooks';
|
|
10
|
+
import { SegmentedPieChartProvider } from './SegmentedPieChartContext';
|
|
10
11
|
|
|
11
12
|
export const SegmentedPieChart = ({
|
|
12
13
|
data,
|
|
@@ -22,6 +23,9 @@ export const SegmentedPieChart = ({
|
|
|
22
23
|
legendPercentageRoundingDigits = 0,
|
|
23
24
|
showDimensions = true,
|
|
24
25
|
showPercentage = true,
|
|
26
|
+
titleTooltipOptions,
|
|
27
|
+
tooltipConfig,
|
|
28
|
+
renderTitleTooltipContent,
|
|
25
29
|
}: SegmentedPieChartProps) => {
|
|
26
30
|
const theme = useTheme();
|
|
27
31
|
|
|
@@ -32,58 +36,59 @@ export const SegmentedPieChart = ({
|
|
|
32
36
|
});
|
|
33
37
|
|
|
34
38
|
return (
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
39
|
+
<SegmentedPieChartProvider
|
|
40
|
+
legendPercentageRoundingDigits={legendPercentageRoundingDigits}
|
|
41
|
+
legendValueRoundingDigits={legendValueRoundingDigits}
|
|
42
|
+
totalAmount={totalAmount}
|
|
43
|
+
totalDimension={totalDimension}
|
|
44
|
+
titleTooltipOptions={titleTooltipOptions}
|
|
45
|
+
showDimensions={showDimensions}
|
|
46
|
+
showPercentage={showPercentage}
|
|
47
|
+
otherLabel={otherLabel}
|
|
48
|
+
currency={currency}
|
|
49
|
+
renderTitleTooltipContent={renderTitleTooltipContent}
|
|
50
|
+
tooltipConfig={tooltipConfig}>
|
|
51
|
+
<PieChart
|
|
52
|
+
data={balanceDataForTheGraph}
|
|
53
|
+
animate={true}
|
|
54
|
+
css={{
|
|
55
|
+
width: 400,
|
|
56
|
+
margin: '40px 120px',
|
|
57
|
+
}}
|
|
58
|
+
isInteractive
|
|
59
|
+
activeInnerRadiusOffset={0}
|
|
60
|
+
activeOuterRadiusOffset={0}
|
|
61
|
+
tooltip={(point) => <ChartTooltip point={point} />}
|
|
62
|
+
title={<ChartTitle />}
|
|
63
|
+
{...pieChartProps}>
|
|
64
|
+
<PieChartLegend
|
|
65
|
+
data={balanceDataForTheLegend}
|
|
66
|
+
backgroundColors={legendBackgrounds}
|
|
67
|
+
renderValue={(props) => (
|
|
68
|
+
<LegendItem
|
|
69
|
+
{...props}
|
|
70
|
+
legendValueRoundingDigits={
|
|
71
|
+
props.legendValueRoundingDigits as number
|
|
72
|
+
}
|
|
73
|
+
/>
|
|
74
|
+
)}
|
|
75
|
+
markerStyles={css`
|
|
76
|
+
width: 10px;
|
|
77
|
+
height: 10px;
|
|
78
|
+
`}
|
|
79
|
+
labelListStyles={css`
|
|
80
|
+
h6 {
|
|
81
|
+
font-weight: 700;
|
|
82
|
+
}
|
|
83
|
+
`}
|
|
84
|
+
valueListStyles={css`
|
|
85
|
+
h6 {
|
|
86
|
+
color: ${theme.colors.greyDarker80};
|
|
63
87
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
/>
|
|
70
|
-
)}
|
|
71
|
-
markerStyles={css`
|
|
72
|
-
width: 10px;
|
|
73
|
-
height: 10px;
|
|
74
|
-
`}
|
|
75
|
-
labelListStyles={css`
|
|
76
|
-
h6 {
|
|
77
|
-
font-weight: 700;
|
|
78
|
-
}
|
|
79
|
-
`}
|
|
80
|
-
valueListStyles={css`
|
|
81
|
-
h6 {
|
|
82
|
-
color: ${theme.colors.greyDarker80};
|
|
83
|
-
}
|
|
84
|
-
`}
|
|
85
|
-
{...pieChartLegendProps}
|
|
86
|
-
/>
|
|
87
|
-
</PieChart>
|
|
88
|
+
`}
|
|
89
|
+
{...pieChartLegendProps}
|
|
90
|
+
/>
|
|
91
|
+
</PieChart>
|
|
92
|
+
</SegmentedPieChartProvider>
|
|
88
93
|
);
|
|
89
94
|
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
import { SegmentedPieChartProps } from './types';
|
|
3
|
+
|
|
4
|
+
type ContextType = Pick<
|
|
5
|
+
SegmentedPieChartProps,
|
|
6
|
+
| 'renderTitleTooltipContent'
|
|
7
|
+
| 'totalAmount'
|
|
8
|
+
| 'totalDimension'
|
|
9
|
+
| 'titleTooltipOptions'
|
|
10
|
+
| 'legendValueRoundingDigits'
|
|
11
|
+
| 'tooltipConfig'
|
|
12
|
+
| 'showDimensions'
|
|
13
|
+
| 'showPercentage'
|
|
14
|
+
| 'otherLabel'
|
|
15
|
+
| 'currency'
|
|
16
|
+
> & {
|
|
17
|
+
legendPercentageRoundingDigits: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const SegmentedPieChartContext = createContext<ContextType>({
|
|
21
|
+
totalAmount: 0,
|
|
22
|
+
totalDimension: '',
|
|
23
|
+
legendPercentageRoundingDigits: 0,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const SegmentedPieChartProvider = ({
|
|
27
|
+
children,
|
|
28
|
+
legendPercentageRoundingDigits,
|
|
29
|
+
totalAmount,
|
|
30
|
+
totalDimension,
|
|
31
|
+
titleTooltipOptions,
|
|
32
|
+
showDimensions,
|
|
33
|
+
showPercentage,
|
|
34
|
+
otherLabel,
|
|
35
|
+
currency,
|
|
36
|
+
renderTitleTooltipContent,
|
|
37
|
+
}: {
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
} & ContextType) => (
|
|
40
|
+
<SegmentedPieChartContext.Provider
|
|
41
|
+
value={{
|
|
42
|
+
legendPercentageRoundingDigits,
|
|
43
|
+
totalAmount,
|
|
44
|
+
totalDimension,
|
|
45
|
+
titleTooltipOptions,
|
|
46
|
+
showDimensions,
|
|
47
|
+
showPercentage,
|
|
48
|
+
otherLabel,
|
|
49
|
+
currency,
|
|
50
|
+
renderTitleTooltipContent,
|
|
51
|
+
}}>
|
|
52
|
+
{children}
|
|
53
|
+
</SegmentedPieChartContext.Provider>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
export const useSegmentedPieChartContext = () => {
|
|
57
|
+
return useContext(SegmentedPieChartContext);
|
|
58
|
+
};
|
|
@@ -1,34 +1,91 @@
|
|
|
1
1
|
import { useTheme, css } from '@emotion/react';
|
|
2
2
|
import Typography from '@components/Typography';
|
|
3
|
+
import Tooltip from '@components/Tooltip';
|
|
4
|
+
import TooltipTrigger from '@components/TooltipTrigger';
|
|
5
|
+
import TooltipContent from '@components/TooltipContent';
|
|
6
|
+
import { getRoundedNumber } from '../utils';
|
|
7
|
+
import { useSegmentedPieChartContext } from '../SegmentedPieChartContext';
|
|
3
8
|
|
|
4
|
-
export const ChartTitle = ({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
export const ChartTitle = () => {
|
|
10
|
+
const {
|
|
11
|
+
totalAmount,
|
|
12
|
+
totalDimension,
|
|
13
|
+
titleTooltipOptions = [],
|
|
14
|
+
legendPercentageRoundingDigits = 0,
|
|
15
|
+
legendValueRoundingDigits = 0,
|
|
16
|
+
tooltipConfig = {},
|
|
17
|
+
showDimensions,
|
|
18
|
+
showPercentage,
|
|
19
|
+
renderTitleTooltipContent,
|
|
20
|
+
} = useSegmentedPieChartContext();
|
|
11
21
|
const theme = useTheme();
|
|
22
|
+
const tooltipContent = renderTitleTooltipContent ? (
|
|
23
|
+
renderTitleTooltipContent({ totalAmount, totalDimension })
|
|
24
|
+
) : (
|
|
25
|
+
<table
|
|
26
|
+
css={{
|
|
27
|
+
background: theme.colors.greyLighter,
|
|
28
|
+
borderRadius: 8,
|
|
29
|
+
padding: 5,
|
|
30
|
+
fontSize: 12,
|
|
31
|
+
fontWeight: 500,
|
|
32
|
+
'& td': {
|
|
33
|
+
whiteSpace: 'nowrap',
|
|
34
|
+
},
|
|
35
|
+
}}>
|
|
36
|
+
{titleTooltipOptions.map((item, index) => {
|
|
37
|
+
const percentage = (Number(item.value) * 100) / totalAmount;
|
|
38
|
+
const roundedValue = getRoundedNumber(
|
|
39
|
+
item.value,
|
|
40
|
+
item.legendValueRoundingDigits || legendValueRoundingDigits,
|
|
41
|
+
);
|
|
42
|
+
const roundedPercentage = getRoundedNumber(
|
|
43
|
+
percentage,
|
|
44
|
+
item.legendPercentageRoundingDigits || legendPercentageRoundingDigits,
|
|
45
|
+
);
|
|
46
|
+
return (
|
|
47
|
+
<tr key={`chart-title-row-${index}`}>
|
|
48
|
+
<td css={{ fontWeight: 600, padding: '0 5px' }}>{item.label}</td>
|
|
49
|
+
<td>
|
|
50
|
+
{roundedValue} {showDimensions && item.dimension}
|
|
51
|
+
</td>
|
|
52
|
+
{showPercentage && <td>({roundedPercentage}%)</td>}
|
|
53
|
+
</tr>
|
|
54
|
+
);
|
|
55
|
+
})}
|
|
56
|
+
</table>
|
|
57
|
+
);
|
|
12
58
|
return (
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
59
|
+
<Tooltip
|
|
60
|
+
enableHover={titleTooltipOptions?.length > 0}
|
|
61
|
+
enableClick={false}
|
|
62
|
+
{...tooltipConfig}>
|
|
63
|
+
<TooltipTrigger>
|
|
64
|
+
<Typography
|
|
65
|
+
variant="body2"
|
|
66
|
+
weight="bold"
|
|
67
|
+
color={theme.colors.greyDarker}
|
|
68
|
+
css={css`
|
|
69
|
+
font-size: 20px;
|
|
70
|
+
line-height: 25px;
|
|
71
|
+
cursor: default;
|
|
72
|
+
`}>
|
|
73
|
+
{totalAmount}
|
|
74
|
+
<Typography
|
|
75
|
+
variant="body2"
|
|
76
|
+
weight="regular"
|
|
77
|
+
as="span"
|
|
78
|
+
color={theme.colors.greyDarker80}
|
|
79
|
+
css={css`
|
|
80
|
+
font-size: 14px;
|
|
81
|
+
`}>
|
|
82
|
+
{totalDimension}
|
|
83
|
+
</Typography>
|
|
84
|
+
</Typography>
|
|
85
|
+
</TooltipTrigger>
|
|
86
|
+
<TooltipContent css={{ padding: '3px 0' }}>
|
|
87
|
+
{tooltipContent}
|
|
88
|
+
</TooltipContent>
|
|
89
|
+
</Tooltip>
|
|
33
90
|
);
|
|
34
91
|
};
|
|
@@ -3,14 +3,15 @@ import { MayHaveLabel, PieTooltipProps } from '@nivo/pie';
|
|
|
3
3
|
import { pathOr } from '@ssa-ui-kit/utils';
|
|
4
4
|
import { BalanceDataForGraph } from '../types';
|
|
5
5
|
import { getRoundedNumber } from '../utils';
|
|
6
|
+
import { useSegmentedPieChartContext } from '../SegmentedPieChartContext';
|
|
6
7
|
|
|
7
8
|
export const ChartTooltip = ({
|
|
8
9
|
point,
|
|
9
|
-
legendPercentageRoundingDigits,
|
|
10
10
|
}: {
|
|
11
11
|
point: PieTooltipProps<MayHaveLabel>;
|
|
12
|
-
legendPercentageRoundingDigits: number;
|
|
13
12
|
}) => {
|
|
13
|
+
const { legendPercentageRoundingDigits, showDimensions, showPercentage } =
|
|
14
|
+
useSegmentedPieChartContext();
|
|
14
15
|
const theme = useTheme();
|
|
15
16
|
const pointData = pathOr<typeof point, BalanceDataForGraph>({}, [
|
|
16
17
|
'datum',
|
|
@@ -65,9 +66,9 @@ export const ChartTooltip = ({
|
|
|
65
66
|
<tr>
|
|
66
67
|
<td css={{ fontWeight: 600, padding: '0 5px' }}>{pointData.label}</td>
|
|
67
68
|
<td>
|
|
68
|
-
{mainData.value} {mainData.label}
|
|
69
|
+
{mainData.value} {showDimensions && mainData.label}
|
|
69
70
|
</td>
|
|
70
|
-
<td>({mainData.percentage}%)</td>
|
|
71
|
+
{showPercentage && <td>({mainData.percentage}%)</td>}
|
|
71
72
|
</tr>
|
|
72
73
|
{pointData.partLabel && (
|
|
73
74
|
<tr>
|
|
@@ -75,9 +76,10 @@ export const ChartTooltip = ({
|
|
|
75
76
|
{pointData.partLabel}
|
|
76
77
|
</td>
|
|
77
78
|
<td>
|
|
78
|
-
{partData.value}
|
|
79
|
+
{partData.value}{' '}
|
|
80
|
+
{showDimensions && (pointData.legendLabel || pointData.label)}
|
|
79
81
|
</td>
|
|
80
|
-
<td>({partData.percentage}%)</td>
|
|
82
|
+
{showPercentage && <td>({partData.percentage}%)</td>}
|
|
81
83
|
</tr>
|
|
82
84
|
)}
|
|
83
85
|
</table>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LegendItemProps } from '../types';
|
|
3
3
|
import { getRoundedNumber } from '../utils';
|
|
4
|
+
import { useSegmentedPieChartContext } from '../SegmentedPieChartContext';
|
|
4
5
|
|
|
5
6
|
export const LegendItem = ({
|
|
6
7
|
label,
|
|
@@ -8,12 +9,14 @@ export const LegendItem = ({
|
|
|
8
9
|
percentage,
|
|
9
10
|
legendValue,
|
|
10
11
|
legendValueRoundingDigits,
|
|
11
|
-
legendPercentageRoundingDigits,
|
|
12
|
-
showDimensions,
|
|
13
|
-
showPercentage,
|
|
14
|
-
otherLabel,
|
|
15
|
-
currency,
|
|
16
12
|
}: LegendItemProps) => {
|
|
13
|
+
const {
|
|
14
|
+
legendPercentageRoundingDigits,
|
|
15
|
+
showDimensions,
|
|
16
|
+
showPercentage,
|
|
17
|
+
otherLabel,
|
|
18
|
+
currency,
|
|
19
|
+
} = useSegmentedPieChartContext();
|
|
17
20
|
const legendValueLocal = getRoundedNumber(
|
|
18
21
|
legendValue,
|
|
19
22
|
legendValueRoundingDigits as number,
|
|
@@ -15,12 +15,16 @@ export const useData = ({
|
|
|
15
15
|
'data' | 'pieChartColors' | 'legendValueRoundingDigits'
|
|
16
16
|
>) => {
|
|
17
17
|
let calculatedTotalAmount = 0;
|
|
18
|
-
|
|
18
|
+
const dataLocal = Array.isArray(data) ? data : [];
|
|
19
|
+
const pieChartColorsLocal = Array.isArray(pieChartColors)
|
|
20
|
+
? pieChartColors
|
|
21
|
+
: [[]];
|
|
22
|
+
dataLocal?.forEach((item) => {
|
|
19
23
|
calculatedTotalAmount += Number(item.value);
|
|
20
24
|
});
|
|
21
25
|
const balanceDataForTheGraph: BalanceDataForGraph[] = [];
|
|
22
26
|
const balanceDataForTheLegend: BalanceDataForGraph[] = [];
|
|
23
|
-
|
|
27
|
+
dataLocal?.forEach((item, itemIndex) => {
|
|
24
28
|
const mainPercentage = (Number(item.value) * 100) / calculatedTotalAmount;
|
|
25
29
|
const newMainItem = {
|
|
26
30
|
value: item.value,
|
|
@@ -33,7 +37,7 @@ export const useData = ({
|
|
|
33
37
|
legendValueRoundingDigits,
|
|
34
38
|
'legendValueRoundingDigits',
|
|
35
39
|
)(item),
|
|
36
|
-
color:
|
|
40
|
+
color: pieChartColorsLocal?.[itemIndex]?.[0],
|
|
37
41
|
id: `${itemIndex}0`,
|
|
38
42
|
};
|
|
39
43
|
balanceDataForTheLegend.push(newMainItem);
|
|
@@ -51,7 +55,7 @@ export const useData = ({
|
|
|
51
55
|
legendValueRoundingDigits,
|
|
52
56
|
'legendValueRoundingDigits',
|
|
53
57
|
)(item),
|
|
54
|
-
color:
|
|
58
|
+
color: pieChartColorsLocal?.[itemIndex]?.[partIndex],
|
|
55
59
|
id: `${itemIndex}${partIndex}`,
|
|
56
60
|
partIndex,
|
|
57
61
|
partLabel: part.label,
|
|
@@ -98,3 +98,26 @@ export const WithoutDimensions = {
|
|
|
98
98
|
showDimensions: false,
|
|
99
99
|
},
|
|
100
100
|
};
|
|
101
|
+
|
|
102
|
+
export const WithTotalTooltip = {
|
|
103
|
+
...StoryTemplate,
|
|
104
|
+
args: {
|
|
105
|
+
titleTooltipOptions: [
|
|
106
|
+
{
|
|
107
|
+
value: 10500,
|
|
108
|
+
label: 'Option 1',
|
|
109
|
+
dimension: 'USDT',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
value: 5000,
|
|
113
|
+
label: 'Option 2',
|
|
114
|
+
dimension: 'USDT',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
value: 2237,
|
|
118
|
+
label: 'Option 3',
|
|
119
|
+
dimension: 'USDT',
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CommonProps } from '@global-types/emotion';
|
|
2
2
|
import { PieChartLegend, PieChartLegendItem, PieChartProps } from '@components';
|
|
3
|
+
import { TooltipProps } from '@components/Tooltip/types';
|
|
3
4
|
|
|
4
5
|
type SegmentedDataMainInfo = {
|
|
5
6
|
label: string;
|
|
@@ -29,6 +30,12 @@ export interface SegmentedPieChartProps extends CommonProps {
|
|
|
29
30
|
legendPercentageRoundingDigits?: number;
|
|
30
31
|
showDimensions?: boolean;
|
|
31
32
|
showPercentage?: boolean;
|
|
33
|
+
titleTooltipOptions?: Array<ChartTitleOption>;
|
|
34
|
+
tooltipConfig?: Partial<TooltipProps>;
|
|
35
|
+
renderTitleTooltipContent?: (props: {
|
|
36
|
+
totalAmount: number;
|
|
37
|
+
totalDimension: string;
|
|
38
|
+
}) => React.ReactNode;
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
export interface BalanceDataForGraph extends PieChartLegendItem {
|
|
@@ -51,11 +58,10 @@ export type LegendItemProps = {
|
|
|
51
58
|
percentage?: number;
|
|
52
59
|
legendValue?: number;
|
|
53
60
|
legendValueRoundingDigits: number;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
>;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export type ChartTitleOption = Pick<BalanceDataForGraph, 'value' | 'label'> & {
|
|
64
|
+
dimension?: string;
|
|
65
|
+
legendValueRoundingDigits?: number;
|
|
66
|
+
legendPercentageRoundingDigits?: number;
|
|
67
|
+
};
|