@wavemaker/react-native-echarts 1.0.0-dev.1 → 1.0.0-dev.10
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/README.md +360 -3
- package/area/area-chart.d.ts +1 -1
- package/area/area-chart.d.ts.map +1 -1
- package/area/area-chart.js +81 -50
- package/area/area-chart.props.d.ts +4 -0
- package/area/area-chart.props.d.ts.map +1 -1
- package/area/index.d.ts +1 -1
- package/area/index.d.ts.map +1 -1
- package/axis.d.ts +26 -0
- package/axis.d.ts.map +1 -1
- package/axis.js +35 -0
- package/bubble/bubble-chart.d.ts.map +1 -1
- package/bubble/bubble-chart.js +66 -35
- package/candlestick/candlestick-chart.d.ts.map +1 -1
- package/candlestick/candlestick-chart.js +37 -8
- package/cartesian/tooltip/axis-tooltip-presets.d.ts +5 -0
- package/cartesian/tooltip/axis-tooltip-presets.d.ts.map +1 -0
- package/cartesian/tooltip/axis-tooltip-presets.js +46 -0
- package/cartesian/tooltip/axis-tooltip.types.d.ts +38 -0
- package/cartesian/tooltip/axis-tooltip.types.d.ts.map +1 -0
- package/cartesian/tooltip/axis-tooltip.types.js +4 -0
- package/cartesian/tooltip/axis-tooltip.utils.d.ts +10 -0
- package/cartesian/tooltip/axis-tooltip.utils.d.ts.map +1 -0
- package/cartesian/tooltip/axis-tooltip.utils.js +121 -0
- package/cartesian/tooltip/default-axis-tooltip.d.ts +9 -0
- package/cartesian/tooltip/default-axis-tooltip.d.ts.map +1 -0
- package/cartesian/tooltip/default-axis-tooltip.js +53 -0
- package/cartesian/tooltip/index.d.ts +7 -0
- package/cartesian/tooltip/index.d.ts.map +1 -0
- package/cartesian/tooltip/index.js +4 -0
- package/cartesian/tooltip/use-axis-tooltip.d.ts +38 -0
- package/cartesian/tooltip/use-axis-tooltip.d.ts.map +1 -0
- package/cartesian/tooltip/use-axis-tooltip.js +54 -0
- package/column/column-chart.d.ts.map +1 -1
- package/column/column-chart.js +93 -33
- package/geo/geo-chart.d.ts.map +1 -1
- package/geo/geo-chart.js +56 -24
- package/geo/geo-chart.props.d.ts +11 -5
- package/geo/geo-chart.props.d.ts.map +1 -1
- package/geo/index.d.ts +1 -0
- package/geo/index.d.ts.map +1 -1
- package/geo/index.js +1 -0
- package/geo/tooltip/default-geo-tooltip.d.ts +6 -0
- package/geo/tooltip/default-geo-tooltip.d.ts.map +1 -0
- package/geo/tooltip/default-geo-tooltip.js +47 -0
- package/geo/tooltip/geo-item-tooltip-presets.d.ts +5 -0
- package/geo/tooltip/geo-item-tooltip-presets.d.ts.map +1 -0
- package/geo/tooltip/geo-item-tooltip-presets.js +35 -0
- package/geo/tooltip/geo-item-tooltip.types.d.ts +19 -0
- package/geo/tooltip/geo-item-tooltip.types.d.ts.map +1 -0
- package/geo/tooltip/geo-item-tooltip.types.js +3 -0
- package/geo/tooltip/geo-item-tooltip.utils.d.ts +14 -0
- package/geo/tooltip/geo-item-tooltip.utils.d.ts.map +1 -0
- package/geo/tooltip/geo-item-tooltip.utils.js +220 -0
- package/geo/tooltip/index.d.ts +7 -0
- package/geo/tooltip/index.d.ts.map +1 -0
- package/geo/tooltip/index.js +4 -0
- package/geo/tooltip/use-geo-item-tooltip.d.ts +26 -0
- package/geo/tooltip/use-geo-item-tooltip.d.ts.map +1 -0
- package/geo/tooltip/use-geo-item-tooltip.js +59 -0
- package/geo/us-chart.js +1 -1
- package/geo/us-states.json +54 -0
- package/geo/world.json +1 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +2 -0
- package/legend/echarts-legend-layout.d.ts +20 -0
- package/legend/echarts-legend-layout.d.ts.map +1 -0
- package/legend/echarts-legend-layout.js +103 -0
- package/line/index.d.ts +1 -1
- package/line/index.d.ts.map +1 -1
- package/line/line-chart.d.ts +1 -1
- package/line/line-chart.d.ts.map +1 -1
- package/line/line-chart.props.d.ts +5 -0
- package/line/line-chart.props.d.ts.map +1 -1
- package/package.json +7 -4
- package/pie/index.d.ts +1 -0
- package/pie/index.d.ts.map +1 -1
- package/pie/index.js +1 -0
- package/pie/pie-chart.d.ts.map +1 -1
- package/pie/pie-chart.js +69 -45
- package/pie/pie-chart.props.d.ts +19 -8
- package/pie/pie-chart.props.d.ts.map +1 -1
- package/pie/tooltip/default-pie-tooltip.d.ts +5 -0
- package/pie/tooltip/default-pie-tooltip.d.ts.map +1 -0
- package/pie/tooltip/default-pie-tooltip.js +57 -0
- package/pie/tooltip/index.d.ts +7 -0
- package/pie/tooltip/index.d.ts.map +1 -0
- package/pie/tooltip/index.js +4 -0
- package/pie/tooltip/pie-item-tooltip-presets.d.ts +5 -0
- package/pie/tooltip/pie-item-tooltip-presets.d.ts.map +1 -0
- package/pie/tooltip/pie-item-tooltip-presets.js +39 -0
- package/pie/tooltip/pie-item-tooltip.types.d.ts +28 -0
- package/pie/tooltip/pie-item-tooltip.types.d.ts.map +1 -0
- package/pie/tooltip/pie-item-tooltip.types.js +3 -0
- package/pie/tooltip/pie-item-tooltip.utils.d.ts +9 -0
- package/pie/tooltip/pie-item-tooltip.utils.d.ts.map +1 -0
- package/pie/tooltip/pie-item-tooltip.utils.js +139 -0
- package/pie/tooltip/use-pie-item-tooltip.d.ts +24 -0
- package/pie/tooltip/use-pie-item-tooltip.d.ts.map +1 -0
- package/pie/tooltip/use-pie-item-tooltip.js +45 -0
- package/props/cartesian.d.ts +50 -13
- package/props/cartesian.d.ts.map +1 -1
- package/props/common.d.ts +2 -0
- package/props/common.d.ts.map +1 -1
- package/radar/index.d.ts +1 -0
- package/radar/index.d.ts.map +1 -1
- package/radar/index.js +1 -0
- package/radar/radar-chart.d.ts.map +1 -1
- package/radar/radar-chart.js +59 -12
- package/radar/radar-chart.props.d.ts +20 -2
- package/radar/radar-chart.props.d.ts.map +1 -1
- package/radar/tooltip/default-radar-tooltip.d.ts +6 -0
- package/radar/tooltip/default-radar-tooltip.d.ts.map +1 -0
- package/radar/tooltip/default-radar-tooltip.js +47 -0
- package/radar/tooltip/index.d.ts +7 -0
- package/radar/tooltip/index.d.ts.map +1 -0
- package/radar/tooltip/index.js +4 -0
- package/radar/tooltip/radar-item-tooltip-presets.d.ts +5 -0
- package/radar/tooltip/radar-item-tooltip-presets.d.ts.map +1 -0
- package/radar/tooltip/radar-item-tooltip-presets.js +50 -0
- package/radar/tooltip/radar-item-tooltip.types.d.ts +28 -0
- package/radar/tooltip/radar-item-tooltip.types.d.ts.map +1 -0
- package/radar/tooltip/radar-item-tooltip.types.js +3 -0
- package/radar/tooltip/radar-item-tooltip.utils.d.ts +9 -0
- package/radar/tooltip/radar-item-tooltip.utils.d.ts.map +1 -0
- package/radar/tooltip/radar-item-tooltip.utils.js +77 -0
- package/radar/tooltip/use-radar-item-tooltip.d.ts +22 -0
- package/radar/tooltip/use-radar-item-tooltip.d.ts.map +1 -0
- package/radar/tooltip/use-radar-item-tooltip.js +43 -0
- package/radial/index.d.ts +1 -0
- package/radial/index.d.ts.map +1 -1
- package/radial/index.js +1 -0
- package/radial/radial-chart.d.ts.map +1 -1
- package/radial/radial-chart.js +44 -16
- package/radial/radial-chart.props.d.ts +16 -3
- package/radial/radial-chart.props.d.ts.map +1 -1
- package/radial/tooltip/default-radial-tooltip.d.ts +6 -0
- package/radial/tooltip/default-radial-tooltip.d.ts.map +1 -0
- package/radial/tooltip/default-radial-tooltip.js +52 -0
- package/radial/tooltip/index.d.ts +7 -0
- package/radial/tooltip/index.d.ts.map +1 -0
- package/radial/tooltip/index.js +4 -0
- package/radial/tooltip/radial-item-tooltip-presets.d.ts +5 -0
- package/radial/tooltip/radial-item-tooltip-presets.d.ts.map +1 -0
- package/radial/tooltip/radial-item-tooltip-presets.js +43 -0
- package/radial/tooltip/radial-item-tooltip.types.d.ts +23 -0
- package/radial/tooltip/radial-item-tooltip.types.d.ts.map +1 -0
- package/radial/tooltip/radial-item-tooltip.types.js +3 -0
- package/radial/tooltip/radial-item-tooltip.utils.d.ts +9 -0
- package/radial/tooltip/radial-item-tooltip.utils.d.ts.map +1 -0
- package/radial/tooltip/radial-item-tooltip.utils.js +122 -0
- package/radial/tooltip/use-radial-item-tooltip.d.ts +22 -0
- package/radial/tooltip/use-radial-item-tooltip.d.ts.map +1 -0
- package/radial/tooltip/use-radial-item-tooltip.js +43 -0
- package/scatter/index.d.ts +1 -0
- package/scatter/index.d.ts.map +1 -1
- package/scatter/index.js +1 -0
- package/scatter/scatter-chart.d.ts.map +1 -1
- package/scatter/scatter-chart.js +64 -22
- package/scatter/scatter-chart.props.d.ts +7 -1
- package/scatter/scatter-chart.props.d.ts.map +1 -1
- package/scatter/tooltip/default-scatter-tooltip.d.ts +8 -0
- package/scatter/tooltip/default-scatter-tooltip.d.ts.map +1 -0
- package/scatter/tooltip/default-scatter-tooltip.js +57 -0
- package/scatter/tooltip/index.d.ts +7 -0
- package/scatter/tooltip/index.d.ts.map +1 -0
- package/scatter/tooltip/index.js +4 -0
- package/scatter/tooltip/scatter-item-tooltip-presets.d.ts +5 -0
- package/scatter/tooltip/scatter-item-tooltip-presets.d.ts.map +1 -0
- package/scatter/tooltip/scatter-item-tooltip-presets.js +49 -0
- package/scatter/tooltip/scatter-item-tooltip.types.d.ts +22 -0
- package/scatter/tooltip/scatter-item-tooltip.types.d.ts.map +1 -0
- package/scatter/tooltip/scatter-item-tooltip.types.js +3 -0
- package/scatter/tooltip/scatter-item-tooltip.utils.d.ts +9 -0
- package/scatter/tooltip/scatter-item-tooltip.utils.d.ts.map +1 -0
- package/scatter/tooltip/scatter-item-tooltip.utils.js +83 -0
- package/scatter/tooltip/use-scatter-item-tooltip.d.ts +25 -0
- package/scatter/tooltip/use-scatter-item-tooltip.d.ts.map +1 -0
- package/scatter/tooltip/use-scatter-item-tooltip.js +46 -0
- package/tooltip/chart-pointer-tooltip-overlay.d.ts +11 -0
- package/tooltip/chart-pointer-tooltip-overlay.d.ts.map +1 -0
- package/tooltip/chart-pointer-tooltip-overlay.js +88 -0
- package/tooltip/chart-tooltip-preset-shells.d.ts +66 -0
- package/tooltip/chart-tooltip-preset-shells.d.ts.map +1 -0
- package/tooltip/chart-tooltip-preset-shells.js +409 -0
- package/tooltip/index.d.ts +7 -0
- package/tooltip/index.d.ts.map +1 -0
- package/tooltip/index.js +1 -0
package/index.d.ts
CHANGED
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/chart/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/chart/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
|
package/index.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { LegendPosition } from '../props/common';
|
|
2
|
+
import type { CartesianGrid } from '../props/cartesian';
|
|
3
|
+
/**
|
|
4
|
+
* Merges optional user `grid` with margins so the plot area clears the legend.
|
|
5
|
+
* Only adds a side when the user has not set that side on `grid`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function mergeCartesianGridForLegend(userGrid: CartesianGrid | undefined, legendPosition: LegendPosition, showLegend: boolean, hasLegendContent: boolean): CartesianGrid | undefined;
|
|
8
|
+
/** Shifts radar center / radius so a vertical legend does not cover the chart. */
|
|
9
|
+
export declare function radarGeometryForLegend(legendPosition: LegendPosition, showLegend: boolean, hasLegend: boolean): {
|
|
10
|
+
center?: [string, string];
|
|
11
|
+
radius?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* ECharts legend fields: horizontal (top/bottom) with width so items wrap;
|
|
15
|
+
* vertical (left/right) in a single column.
|
|
16
|
+
*/
|
|
17
|
+
export declare function echartsLegendLayoutFragment(legendPosition: LegendPosition): Record<string, unknown>;
|
|
18
|
+
/** Shifts pie center slightly when a side legend is shown so slices do not overlap the legend. */
|
|
19
|
+
export declare function pieCenterForLegend(legendPosition: LegendPosition, showLegend: boolean): [string, string] | undefined;
|
|
20
|
+
//# sourceMappingURL=echarts-legend-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"echarts-legend-layout.d.ts","sourceRoot":"","sources":["../../../../components/chart/legend/echarts-legend-layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAQxD;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,aAAa,GAAG,SAAS,EACnC,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,OAAO,EACnB,gBAAgB,EAAE,OAAO,GACxB,aAAa,GAAG,SAAS,CA2B3B;AAED,kFAAkF;AAClF,wBAAgB,sBAAsB,CACpC,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,OAAO,EACnB,SAAS,EAAE,OAAO,GACjB;IAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAYhD;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA8BnG;AAED,kGAAkG;AAClG,wBAAgB,kBAAkB,CAChC,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,OAAO,GAClB,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAa9B"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/** Grid margin (% of width) reserved when the legend is vertical on the left or right. */
|
|
2
|
+
const GRID_LEGEND_SIDE_PCT = '32%';
|
|
3
|
+
/** Extra grid margin (px) when the legend is horizontal at the top or bottom. */
|
|
4
|
+
const GRID_LEGEND_TOP_BOTTOM_PX = 84;
|
|
5
|
+
/**
|
|
6
|
+
* Merges optional user `grid` with margins so the plot area clears the legend.
|
|
7
|
+
* Only adds a side when the user has not set that side on `grid`.
|
|
8
|
+
*/
|
|
9
|
+
export function mergeCartesianGridForLegend(userGrid, legendPosition, showLegend, hasLegendContent) {
|
|
10
|
+
if (!showLegend || !hasLegendContent) {
|
|
11
|
+
return userGrid;
|
|
12
|
+
}
|
|
13
|
+
const patch = {};
|
|
14
|
+
switch (legendPosition) {
|
|
15
|
+
case 'left':
|
|
16
|
+
if (userGrid?.left === undefined)
|
|
17
|
+
patch.left = GRID_LEGEND_SIDE_PCT;
|
|
18
|
+
break;
|
|
19
|
+
case 'right':
|
|
20
|
+
if (userGrid?.right === undefined)
|
|
21
|
+
patch.right = GRID_LEGEND_SIDE_PCT;
|
|
22
|
+
break;
|
|
23
|
+
case 'top':
|
|
24
|
+
if (userGrid?.top === undefined)
|
|
25
|
+
patch.top = GRID_LEGEND_TOP_BOTTOM_PX;
|
|
26
|
+
break;
|
|
27
|
+
case 'bottom':
|
|
28
|
+
default:
|
|
29
|
+
if (userGrid?.bottom === undefined)
|
|
30
|
+
patch.bottom = GRID_LEGEND_TOP_BOTTOM_PX;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
if (Object.keys(patch).length === 0) {
|
|
34
|
+
return userGrid;
|
|
35
|
+
}
|
|
36
|
+
return { ...(userGrid ?? {}), ...patch };
|
|
37
|
+
}
|
|
38
|
+
/** Shifts radar center / radius so a vertical legend does not cover the chart. */
|
|
39
|
+
export function radarGeometryForLegend(legendPosition, showLegend, hasLegend) {
|
|
40
|
+
if (!showLegend || !hasLegend)
|
|
41
|
+
return {};
|
|
42
|
+
switch (legendPosition) {
|
|
43
|
+
case 'left':
|
|
44
|
+
return { center: ['60%', '50%'], radius: '54%' };
|
|
45
|
+
case 'right':
|
|
46
|
+
return { center: ['40%', '50%'], radius: '54%' };
|
|
47
|
+
case 'top':
|
|
48
|
+
case 'bottom':
|
|
49
|
+
default:
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* ECharts legend fields: horizontal (top/bottom) with width so items wrap;
|
|
55
|
+
* vertical (left/right) in a single column.
|
|
56
|
+
*/
|
|
57
|
+
export function echartsLegendLayoutFragment(legendPosition) {
|
|
58
|
+
switch (legendPosition) {
|
|
59
|
+
case 'left':
|
|
60
|
+
return {
|
|
61
|
+
orient: 'vertical',
|
|
62
|
+
top: 'middle',
|
|
63
|
+
left: 8,
|
|
64
|
+
};
|
|
65
|
+
case 'right':
|
|
66
|
+
return {
|
|
67
|
+
orient: 'vertical',
|
|
68
|
+
top: 'middle',
|
|
69
|
+
right: 8,
|
|
70
|
+
};
|
|
71
|
+
case 'top':
|
|
72
|
+
return {
|
|
73
|
+
orient: 'horizontal',
|
|
74
|
+
left: 'center',
|
|
75
|
+
width: '92%',
|
|
76
|
+
top: 8,
|
|
77
|
+
};
|
|
78
|
+
case 'bottom':
|
|
79
|
+
default:
|
|
80
|
+
return {
|
|
81
|
+
orient: 'horizontal',
|
|
82
|
+
left: 'center',
|
|
83
|
+
width: '92%',
|
|
84
|
+
bottom: 8,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Shifts pie center slightly when a side legend is shown so slices do not overlap the legend. */
|
|
89
|
+
export function pieCenterForLegend(legendPosition, showLegend) {
|
|
90
|
+
if (!showLegend)
|
|
91
|
+
return undefined;
|
|
92
|
+
switch (legendPosition) {
|
|
93
|
+
case 'top':
|
|
94
|
+
return ['50%', '54%'];
|
|
95
|
+
case 'left':
|
|
96
|
+
return ['56%', '50%'];
|
|
97
|
+
case 'right':
|
|
98
|
+
return ['44%', '50%'];
|
|
99
|
+
case 'bottom':
|
|
100
|
+
default:
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
}
|
package/line/index.d.ts
CHANGED
package/line/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/chart/line/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/chart/line/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EACV,cAAc,EACd,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,oBAAoB,CAAC"}
|
package/line/line-chart.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { LineChartProps } from './line-chart.props';
|
|
3
3
|
/** common -> cartesian -> area -> line */
|
|
4
|
-
export type { LineChartProps } from './line-chart.props';
|
|
4
|
+
export type { LineChartProps, LineChartAxisTooltipParams, LineChartTooltipSeriesItem, } from './line-chart.props';
|
|
5
5
|
declare function LineChartComponent(props: LineChartProps): React.JSX.Element;
|
|
6
6
|
export declare const LineChart: typeof LineChartComponent & {
|
|
7
7
|
displayName: string;
|
package/line/line-chart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/line/line-chart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,0CAA0C;AAC1C,YAAY,
|
|
1
|
+
{"version":3,"file":"line-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/line/line-chart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,0CAA0C;AAC1C,YAAY,EACV,cAAc,EACd,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,oBAAoB,CAAC;AAE5B,iBAAS,kBAAkB,CAAC,KAAK,EAAE,cAAc,qBAEhD;AAED,eAAO,MAAM,SAAS;;CAEpB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AreaChartProps } from '../area/area-chart.props';
|
|
2
2
|
import type { CartesianChartSelectEvent } from '../props/cartesian';
|
|
3
|
+
import type { AxisTooltipParams, AxisTooltipSeriesItem } from '../cartesian/tooltip/axis-tooltip.types';
|
|
3
4
|
/**
|
|
4
5
|
* Props for LineChart.
|
|
5
6
|
* Line chart is AreaChart with no fill (areaOpacity=0, areaFill='transparent').
|
|
@@ -7,6 +8,10 @@ import type { CartesianChartSelectEvent } from '../props/cartesian';
|
|
|
7
8
|
* common -> cartesian -> area -> line
|
|
8
9
|
*/
|
|
9
10
|
export type LineChartProps = Omit<AreaChartProps, 'areaOpacity' | 'areaFill'>;
|
|
11
|
+
/** Per-series row in axis tooltip params for {@link LineChartProps#renderTooltip}. */
|
|
12
|
+
export type LineChartTooltipSeriesItem = AxisTooltipSeriesItem;
|
|
13
|
+
/** Axis tooltip params for {@link LineChartProps#renderTooltip}. */
|
|
14
|
+
export type LineChartAxisTooltipParams = AxisTooltipParams;
|
|
10
15
|
/** Selection payload for {@link LineChartProps} / `onSelect` (same as {@link CartesianChartSelectEvent}). */
|
|
11
16
|
export type LineChartSelectEvent = CartesianChartSelectEvent;
|
|
12
17
|
//# sourceMappingURL=line-chart.props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-chart.props.d.ts","sourceRoot":"","sources":["../../../../components/chart/line/line-chart.props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"line-chart.props.d.ts","sourceRoot":"","sources":["../../../../components/chart/line/line-chart.props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAExG;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,EAAE,aAAa,GAAG,UAAU,CAAC,CAAC;AAE9E,sFAAsF;AACtF,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,CAAC;AAE/D,oEAAoE;AACpE,MAAM,MAAM,0BAA0B,GAAG,iBAAiB,CAAC;AAE3D,6GAA6G;AAC7G,MAAM,MAAM,oBAAoB,GAAG,yBAAyB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavemaker/react-native-echarts",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.10",
|
|
4
4
|
"description": "React Native chart components built on using e-charts library.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,11 +33,14 @@
|
|
|
33
33
|
"react": "*",
|
|
34
34
|
"react-native": "*",
|
|
35
35
|
"@shopify/react-native-skia": "*",
|
|
36
|
-
"@wuba/react-native-echarts": "
|
|
37
|
-
"echarts": "
|
|
36
|
+
"@wuba/react-native-echarts": "^3.0.1",
|
|
37
|
+
"echarts": "^6.0.0",
|
|
38
38
|
"zrender": "*",
|
|
39
39
|
"react-native-svg": "*"
|
|
40
40
|
},
|
|
41
|
-
"dependencies": {
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@wuba/react-native-echarts": "^3.0.1",
|
|
43
|
+
"echarts": "^6.0.0"
|
|
44
|
+
},
|
|
42
45
|
"private": false
|
|
43
46
|
}
|
package/pie/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { PieChart } from './pie-chart';
|
|
2
2
|
export { isConcentricPieData } from './pie-chart.props';
|
|
3
3
|
export type { PieChartProps, PieChartData, PieChartSelectEvent, PieDataItem, PieRingData, } from './pie-chart.props';
|
|
4
|
+
export * from './tooltip';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/pie/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/chart/pie/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,YAAY,EACV,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,WAAW,GACZ,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/chart/pie/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,YAAY,EACV,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
package/pie/index.js
CHANGED
package/pie/pie-chart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pie-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/pie/pie-chart.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pie-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/pie/pie-chart.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,EAId,MAAM,mBAAmB,CAAC;AAY3B,OAAO,KAAqC,MAAM,OAAO,CAAC;AAI1D,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AA4RxD,eAAO,MAAM,QAAQ;;;;;;;CAEnB,CAAC"}
|
package/pie/pie-chart.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { withResponsiveContainer } from '../chart-container';
|
|
2
2
|
import { useChartTheme, withChartTheme } from '../chart-theme.context';
|
|
3
|
+
import { axisTooltipShowContentFlag } from '../cartesian/tooltip';
|
|
3
4
|
import { isConcentricPieData } from './pie-chart.props';
|
|
5
|
+
import { echartsLegendLayoutFragment, pieCenterForLegend } from '../legend/echarts-legend-layout';
|
|
6
|
+
import { createPieTooltipPreset, usePieItemTooltip } from './tooltip';
|
|
4
7
|
import { SkiaChart, SkiaRenderer } from '@wuba/react-native-echarts';
|
|
5
8
|
import { PieChart as EChartsPieChart } from 'echarts/charts';
|
|
6
9
|
import { LegendComponent, TooltipComponent, } from 'echarts/components';
|
|
7
10
|
import * as echarts from 'echarts/core';
|
|
8
11
|
import React, { useEffect, useMemo, useRef } from 'react';
|
|
12
|
+
import { View } from 'react-native';
|
|
9
13
|
export { isConcentricPieData } from './pie-chart.props';
|
|
10
14
|
echarts.use([
|
|
11
15
|
TooltipComponent,
|
|
@@ -13,11 +17,44 @@ echarts.use([
|
|
|
13
17
|
SkiaRenderer,
|
|
14
18
|
EChartsPieChart,
|
|
15
19
|
]);
|
|
16
|
-
const ChartComponent = ({ data, width = 220, height = 350, radius = '75%', showLegend =
|
|
20
|
+
const ChartComponent = ({ data, width = 220, height = 350, radius = '75%', showLegend = true, legendPosition = 'bottom', showLabel = true, labelPosition = 'outside', showLabelLine = true, showHighlighter = true, tooltip = 'card', renderTooltip, onSelect, ...props }) => {
|
|
17
21
|
const { theme } = useChartTheme(props.theme, props.colors);
|
|
18
22
|
const chartRef = useRef(null);
|
|
19
23
|
const onSelectRef = useRef(onSelect);
|
|
20
24
|
onSelectRef.current = onSelect;
|
|
25
|
+
const pieContextRef = useRef({ normalizedSeries: [] });
|
|
26
|
+
const themeSeriesRef = useRef(theme.series);
|
|
27
|
+
themeSeriesRef.current = theme.series;
|
|
28
|
+
const tooltipOverlayActive = renderTooltip != null || tooltip !== 'none';
|
|
29
|
+
const renderTooltipFn = useMemo(() => {
|
|
30
|
+
if (renderTooltip != null)
|
|
31
|
+
return renderTooltip;
|
|
32
|
+
if (tooltip === 'none')
|
|
33
|
+
return () => null;
|
|
34
|
+
return createPieTooltipPreset(tooltip);
|
|
35
|
+
}, [renderTooltip, tooltip]);
|
|
36
|
+
const { attachPieItemTooltipListeners, renderPieTooltipOverlay } = usePieItemTooltip({
|
|
37
|
+
active: tooltipOverlayActive,
|
|
38
|
+
renderTooltip: renderTooltipFn,
|
|
39
|
+
contextRef: pieContextRef,
|
|
40
|
+
themeSeriesRef,
|
|
41
|
+
width,
|
|
42
|
+
height,
|
|
43
|
+
});
|
|
44
|
+
const normalizedSeries = useMemo(() => {
|
|
45
|
+
if (!Array.isArray(data) || data.length === 0)
|
|
46
|
+
return [];
|
|
47
|
+
if (isConcentricPieData(data)) {
|
|
48
|
+
const rings = data;
|
|
49
|
+
return rings.map((ring) => ({
|
|
50
|
+
name: ring.name,
|
|
51
|
+
data: ring.data.map((d) => ({ name: d.name, value: d.value })),
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
const flat = data;
|
|
55
|
+
return [{ data: flat.map((d) => ({ name: d.name, value: d.value })) }];
|
|
56
|
+
}, [data]);
|
|
57
|
+
pieContextRef.current = { normalizedSeries };
|
|
21
58
|
const option = useMemo(() => {
|
|
22
59
|
if (!Array.isArray(data) || data.length === 0) {
|
|
23
60
|
return { series: [] };
|
|
@@ -27,7 +64,7 @@ const ChartComponent = ({ data, width = 220, height = 350, radius = '75%', showL
|
|
|
27
64
|
color: theme.legend.textColor,
|
|
28
65
|
fontSize: theme.legend.fontSize,
|
|
29
66
|
};
|
|
30
|
-
const buildSeriesConfig = (pieData, seriesRadius, ringName) => {
|
|
67
|
+
const buildSeriesConfig = (pieData, seriesRadius, ringName, seriesCenter) => {
|
|
31
68
|
const total = pieData.reduce((sum, d) => sum + d.value, 0);
|
|
32
69
|
const labelConfig = showLabel
|
|
33
70
|
? {
|
|
@@ -44,6 +81,7 @@ const ChartComponent = ({ data, width = 220, height = 350, radius = '75%', showL
|
|
|
44
81
|
type: 'pie',
|
|
45
82
|
name: ringName,
|
|
46
83
|
radius: Array.isArray(seriesRadius) ? seriesRadius : seriesRadius,
|
|
84
|
+
...(seriesCenter ? { center: seriesCenter } : {}),
|
|
47
85
|
data: pieData,
|
|
48
86
|
label: labelConfig,
|
|
49
87
|
labelLine: {
|
|
@@ -52,6 +90,7 @@ const ChartComponent = ({ data, width = 220, height = 350, radius = '75%', showL
|
|
|
52
90
|
},
|
|
53
91
|
emphasis: showHighlighter
|
|
54
92
|
? {
|
|
93
|
+
focus: 'none',
|
|
55
94
|
scale: true,
|
|
56
95
|
scaleSize: 5,
|
|
57
96
|
itemStyle: {
|
|
@@ -65,6 +104,7 @@ const ChartComponent = ({ data, width = 220, height = 350, radius = '75%', showL
|
|
|
65
104
|
};
|
|
66
105
|
if (isConcentricPieData(data)) {
|
|
67
106
|
const rings = data;
|
|
107
|
+
const pieSeriesCenter = pieCenterForLegend(legendPosition, showLegend);
|
|
68
108
|
let colorIndex = 0;
|
|
69
109
|
const seriesConfigs = rings.map((ring) => {
|
|
70
110
|
const pieData = ring.data.map((item) => ({
|
|
@@ -74,37 +114,25 @@ const ChartComponent = ({ data, width = 220, height = 350, radius = '75%', showL
|
|
|
74
114
|
? { color: item.itemStyle.color }
|
|
75
115
|
: { color: seriesColors[colorIndex++ % seriesColors.length] },
|
|
76
116
|
}));
|
|
77
|
-
return buildSeriesConfig(pieData, ring.radius, ring.name);
|
|
117
|
+
return buildSeriesConfig(pieData, ring.radius, ring.name, pieSeriesCenter);
|
|
78
118
|
});
|
|
79
119
|
const legendData = showLegend
|
|
80
120
|
? Array.from(new Set(rings.flatMap((r) => r.data.map((d) => d.name))))
|
|
81
121
|
: undefined;
|
|
82
|
-
const tooltipConfig =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
padding: theme.tooltip.padding,
|
|
89
|
-
textStyle: { color: theme.tooltip.valueColor },
|
|
90
|
-
formatter: tooltipFormatter
|
|
91
|
-
? (params) => tooltipFormatter({
|
|
92
|
-
name: params.name,
|
|
93
|
-
value: params.value,
|
|
94
|
-
percent: params.percent,
|
|
95
|
-
})
|
|
96
|
-
: undefined,
|
|
97
|
-
};
|
|
122
|
+
const tooltipConfig = tooltipOverlayActive
|
|
123
|
+
? {
|
|
124
|
+
trigger: 'item',
|
|
125
|
+
...axisTooltipShowContentFlag(true),
|
|
126
|
+
}
|
|
127
|
+
: { show: false };
|
|
98
128
|
const config = {
|
|
99
129
|
tooltip: tooltipConfig,
|
|
100
130
|
series: seriesConfigs,
|
|
101
131
|
};
|
|
102
132
|
if (legendData?.length) {
|
|
103
133
|
config.legend = {
|
|
104
|
-
orient: 'horizontal',
|
|
105
|
-
left: 'center',
|
|
106
|
-
bottom: 0,
|
|
107
134
|
data: legendData,
|
|
135
|
+
...echartsLegendLayoutFragment(legendPosition),
|
|
108
136
|
textStyle: labelStyle,
|
|
109
137
|
backgroundColor: theme.legend.backgroundColor,
|
|
110
138
|
};
|
|
@@ -119,29 +147,18 @@ const ChartComponent = ({ data, width = 220, height = 350, radius = '75%', showL
|
|
|
119
147
|
? { color: item.itemStyle.color }
|
|
120
148
|
: { color: seriesColors[index % seriesColors.length] },
|
|
121
149
|
}));
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
textStyle: { color: theme.tooltip.valueColor },
|
|
131
|
-
formatter: tooltipFormatter
|
|
132
|
-
? (params) => tooltipFormatter({
|
|
133
|
-
name: params.name,
|
|
134
|
-
value: params.value,
|
|
135
|
-
percent: params.percent,
|
|
136
|
-
})
|
|
137
|
-
: undefined,
|
|
138
|
-
};
|
|
150
|
+
const pieSeriesCenter = pieCenterForLegend(legendPosition, showLegend);
|
|
151
|
+
const seriesConfig = buildSeriesConfig(pieData, radius, undefined, pieSeriesCenter);
|
|
152
|
+
const tooltipConfig = tooltipOverlayActive
|
|
153
|
+
? {
|
|
154
|
+
trigger: 'item',
|
|
155
|
+
...axisTooltipShowContentFlag(true),
|
|
156
|
+
}
|
|
157
|
+
: { show: false };
|
|
139
158
|
const legendConfig = showLegend
|
|
140
159
|
? {
|
|
141
|
-
orient: 'horizontal',
|
|
142
|
-
left: 'center',
|
|
143
|
-
bottom: 0,
|
|
144
160
|
data: pieData.map((d) => d.name),
|
|
161
|
+
...echartsLegendLayoutFragment(legendPosition),
|
|
145
162
|
textStyle: labelStyle,
|
|
146
163
|
backgroundColor: theme.legend.backgroundColor,
|
|
147
164
|
}
|
|
@@ -158,15 +175,17 @@ const ChartComponent = ({ data, width = 220, height = 350, radius = '75%', showL
|
|
|
158
175
|
data,
|
|
159
176
|
radius,
|
|
160
177
|
showLegend,
|
|
178
|
+
legendPosition,
|
|
161
179
|
showLabel,
|
|
162
180
|
labelPosition,
|
|
163
181
|
showLabelLine,
|
|
164
182
|
showHighlighter,
|
|
165
|
-
|
|
183
|
+
tooltipOverlayActive,
|
|
166
184
|
theme,
|
|
167
185
|
]);
|
|
168
186
|
useEffect(() => {
|
|
169
187
|
let chart;
|
|
188
|
+
let detachPieTooltip = () => { };
|
|
170
189
|
if (chartRef.current) {
|
|
171
190
|
try {
|
|
172
191
|
chart = echarts.init(chartRef.current, 'light', {
|
|
@@ -174,6 +193,7 @@ const ChartComponent = ({ data, width = 220, height = 350, radius = '75%', showL
|
|
|
174
193
|
height,
|
|
175
194
|
});
|
|
176
195
|
chart.setOption(option);
|
|
196
|
+
detachPieTooltip = attachPieItemTooltipListeners(chart);
|
|
177
197
|
const handlePieClick = (params) => {
|
|
178
198
|
const cb = onSelectRef.current;
|
|
179
199
|
if (typeof cb !== 'function')
|
|
@@ -204,6 +224,7 @@ const ChartComponent = ({ data, width = 220, height = 350, radius = '75%', showL
|
|
|
204
224
|
}
|
|
205
225
|
}
|
|
206
226
|
return () => {
|
|
227
|
+
detachPieTooltip();
|
|
207
228
|
if (chart) {
|
|
208
229
|
try {
|
|
209
230
|
chart.dispose();
|
|
@@ -213,8 +234,11 @@ const ChartComponent = ({ data, width = 220, height = 350, radius = '75%', showL
|
|
|
213
234
|
}
|
|
214
235
|
}
|
|
215
236
|
};
|
|
216
|
-
}, [option, width, height]);
|
|
217
|
-
return <
|
|
237
|
+
}, [option, width, height, attachPieItemTooltipListeners]);
|
|
238
|
+
return (<View style={{ width, height, position: 'relative' }}>
|
|
239
|
+
<SkiaChart ref={chartRef} useRNGH/>
|
|
240
|
+
{renderPieTooltipOverlay()}
|
|
241
|
+
</View>);
|
|
218
242
|
};
|
|
219
243
|
const PieChartComponent = withResponsiveContainer(withChartTheme(ChartComponent), 'data');
|
|
220
244
|
export const PieChart = Object.assign(PieChartComponent, {
|
package/pie/pie-chart.props.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type { CommonChartProps } from '../props/common';
|
|
1
|
+
import type { CommonChartProps, LegendPosition } from '../props/common';
|
|
2
|
+
import type { ChartTooltipOption } from '../tooltip';
|
|
3
|
+
import type { PieItemTooltipParams } from './tooltip/pie-item-tooltip.types';
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
2
5
|
/** Emitted when the user taps/clicks a pie slice. */
|
|
3
6
|
export interface PieChartSelectEvent {
|
|
4
7
|
seriesIndex: number;
|
|
@@ -58,9 +61,14 @@ export interface PieChartProps extends CommonChartProps {
|
|
|
58
61
|
radius?: number | string | (number | string)[];
|
|
59
62
|
/**
|
|
60
63
|
* Whether to show the legend for slices.
|
|
61
|
-
* @default
|
|
64
|
+
* @default true
|
|
62
65
|
*/
|
|
63
66
|
showLegend?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Legend position. Top and bottom use a horizontal legend that wraps; left and right use a vertical legend.
|
|
69
|
+
* @default 'bottom'
|
|
70
|
+
*/
|
|
71
|
+
legendPosition?: LegendPosition;
|
|
64
72
|
/**
|
|
65
73
|
* Whether to show slice labels (name/value on the chart).
|
|
66
74
|
* @default true
|
|
@@ -82,13 +90,16 @@ export interface PieChartProps extends CommonChartProps {
|
|
|
82
90
|
*/
|
|
83
91
|
showHighlighter?: boolean;
|
|
84
92
|
/**
|
|
85
|
-
*
|
|
93
|
+
* Built-in item tooltip preset when `renderTooltip` is omitted. Use `none` to hide the overlay.
|
|
94
|
+
* When `renderTooltip` is set, it replaces the preset body. Overlay hidden only when `tooltip` is `none` and `renderTooltip` is omitted.
|
|
95
|
+
* @default 'card'
|
|
96
|
+
*/
|
|
97
|
+
tooltip?: ChartTooltipOption;
|
|
98
|
+
/**
|
|
99
|
+
* Overrides the default React Native **item** tooltip body for pie slices (see {@link PieItemTooltipParams}).
|
|
100
|
+
* Takes precedence over {@link tooltip}.
|
|
86
101
|
*/
|
|
87
|
-
|
|
88
|
-
name: string;
|
|
89
|
-
value: number;
|
|
90
|
-
percent?: number;
|
|
91
|
-
}) => string;
|
|
102
|
+
renderTooltip?: (params: PieItemTooltipParams) => ReactNode;
|
|
92
103
|
/**
|
|
93
104
|
* Called when the user selects (taps/clicks) a slice.
|
|
94
105
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pie-chart.props.d.ts","sourceRoot":"","sources":["../../../../components/chart/pie/pie-chart.props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"pie-chart.props.d.ts","sourceRoot":"","sources":["../../../../components/chart/pie/pie-chart.props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,qDAAqD;AACrD,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,SAAS,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sFAAsF;IACtF,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC5B,gCAAgC;IAChC,IAAI,EAAE,WAAW,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,EAAE,GAAG,WAAW,EAAE,CAAC;AAEzD;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,YAAY,GACjB,IAAI,IAAI,WAAW,EAAE,CASvB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACrD;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC/C;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAChD;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,SAAS,CAAC;IAC5D;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACjD"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ChartTheme } from '../../chart-theme.context';
|
|
3
|
+
import type { PieItemTooltipParams } from './pie-item-tooltip.types';
|
|
4
|
+
export declare function createDefaultPieTooltip(theme: Pick<ChartTheme, 'tooltip'>): (params: PieItemTooltipParams) => React.ReactElement;
|
|
5
|
+
//# sourceMappingURL=default-pie-tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-pie-tooltip.d.ts","sourceRoot":"","sources":["../../../../../components/chart/pie/tooltip/default-pie-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,GACjC,CAAC,MAAM,EAAE,oBAAoB,KAAK,KAAK,CAAC,YAAY,CAoCtD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
export function createDefaultPieTooltip(theme) {
|
|
4
|
+
const t = theme.tooltip;
|
|
5
|
+
return function DefaultPieTooltip(params) {
|
|
6
|
+
const { name, value, percent, color, ringName } = params;
|
|
7
|
+
return (<View style={{
|
|
8
|
+
backgroundColor: t.backgroundColor,
|
|
9
|
+
borderColor: t.borderColor,
|
|
10
|
+
borderWidth: t.borderWidth,
|
|
11
|
+
borderRadius: t.borderRadius,
|
|
12
|
+
padding: t.padding,
|
|
13
|
+
}}>
|
|
14
|
+
{ringName != null && ringName !== '' ? (<Text style={[styles.ring, { color: t.labelColor }]}>{ringName}</Text>) : null}
|
|
15
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 4 }}>
|
|
16
|
+
{color != null && color !== '' ? (<View style={[styles.swatch, { backgroundColor: color }]}/>) : (<View style={styles.swatchPlaceholder}/>)}
|
|
17
|
+
<Text style={[styles.title, { color: t.labelColor }]}>{name}</Text>
|
|
18
|
+
</View>
|
|
19
|
+
<Text style={[styles.line, { color: t.valueColor }]}>
|
|
20
|
+
<Text style={{ color: t.labelColor }}>value: </Text>
|
|
21
|
+
{String(value)}
|
|
22
|
+
</Text>
|
|
23
|
+
<Text style={[styles.line, { color: t.valueColor }]}>
|
|
24
|
+
<Text style={{ color: t.labelColor }}>share: </Text>
|
|
25
|
+
{percent.toFixed(1)}%
|
|
26
|
+
</Text>
|
|
27
|
+
</View>);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const styles = StyleSheet.create({
|
|
31
|
+
ring: {
|
|
32
|
+
fontSize: 11,
|
|
33
|
+
fontWeight: '600',
|
|
34
|
+
marginBottom: 4,
|
|
35
|
+
textTransform: 'uppercase',
|
|
36
|
+
},
|
|
37
|
+
title: {
|
|
38
|
+
fontWeight: '600',
|
|
39
|
+
fontSize: 13,
|
|
40
|
+
flex: 1,
|
|
41
|
+
},
|
|
42
|
+
line: {
|
|
43
|
+
fontSize: 12,
|
|
44
|
+
marginTop: 2,
|
|
45
|
+
},
|
|
46
|
+
swatch: {
|
|
47
|
+
width: 8,
|
|
48
|
+
height: 8,
|
|
49
|
+
borderRadius: 4,
|
|
50
|
+
marginRight: 6,
|
|
51
|
+
},
|
|
52
|
+
swatchPlaceholder: {
|
|
53
|
+
width: 8,
|
|
54
|
+
height: 8,
|
|
55
|
+
marginRight: 6,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createDefaultPieTooltip } from './default-pie-tooltip';
|
|
2
|
+
export { createPieTooltipPreset } from './pie-item-tooltip-presets';
|
|
3
|
+
export type { PieItemTooltipContext, PieItemTooltipParams } from './pie-item-tooltip.types';
|
|
4
|
+
export { pieItemParamsFromShowTip } from './pie-item-tooltip.utils';
|
|
5
|
+
export { usePieItemTooltip } from './use-pie-item-tooltip';
|
|
6
|
+
export type { UsePieItemTooltipOptions, UsePieItemTooltipResult } from './use-pie-item-tooltip';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../components/chart/pie/tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,YAAY,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ChartTooltipPreset } from '../../tooltip';
|
|
3
|
+
import type { PieItemTooltipParams } from './pie-item-tooltip.types';
|
|
4
|
+
export declare function createPieTooltipPreset(preset: ChartTooltipPreset): (params: PieItemTooltipParams) => React.ReactElement;
|
|
5
|
+
//# sourceMappingURL=pie-item-tooltip-presets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie-item-tooltip-presets.d.ts","sourceRoot":"","sources":["../../../../../components/chart/pie/tooltip/pie-item-tooltip-presets.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAOxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AA+CrE,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,kBAAkB,GACzB,CAAC,MAAM,EAAE,oBAAoB,KAAK,KAAK,CAAC,YAAY,CAYtD"}
|