@wavemaker/react-native-echarts 1.0.0-dev.11 → 1.0.0-dev.13
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 +24 -0
- package/area/area-chart.d.ts.map +1 -1
- package/area/area-chart.js +21 -13
- package/axis.d.ts +13 -0
- package/axis.d.ts.map +1 -1
- package/axis.js +20 -0
- package/candlestick/candlestick-chart.d.ts.map +1 -1
- package/candlestick/candlestick-chart.js +7 -3
- package/chart-container.js +2 -2
- package/column/column-chart.d.ts.map +1 -1
- package/column/column-chart.js +53 -33
- package/gauge/digital/digital.gauge.d.ts.map +1 -1
- package/gauge/digital/digital.gauge.js +23 -16
- package/gauge/radial/radial.gauge.d.ts.map +1 -1
- package/gauge/radial/radial.gauge.js +10 -13
- package/heatmap/heatmap-chart.d.ts +13 -0
- package/heatmap/heatmap-chart.d.ts.map +1 -0
- package/heatmap/heatmap-chart.js +232 -0
- package/heatmap/heatmap-chart.props.d.ts +44 -0
- package/heatmap/heatmap-chart.props.d.ts.map +1 -0
- package/heatmap/heatmap-chart.props.js +0 -0
- package/heatmap/index.d.ts +4 -0
- package/heatmap/index.d.ts.map +1 -0
- package/heatmap/index.js +2 -0
- package/heatmap/tooltip/heatmap-item-tooltip-presets.d.ts +5 -0
- package/heatmap/tooltip/heatmap-item-tooltip-presets.d.ts.map +1 -0
- package/heatmap/tooltip/heatmap-item-tooltip-presets.js +41 -0
- package/heatmap/tooltip/heatmap-item-tooltip.types.d.ts +23 -0
- package/heatmap/tooltip/heatmap-item-tooltip.types.d.ts.map +1 -0
- package/heatmap/tooltip/heatmap-item-tooltip.types.js +3 -0
- package/heatmap/tooltip/heatmap-item-tooltip.utils.d.ts +8 -0
- package/heatmap/tooltip/heatmap-item-tooltip.utils.d.ts.map +1 -0
- package/heatmap/tooltip/heatmap-item-tooltip.utils.js +87 -0
- package/heatmap/tooltip/index.d.ts +4 -0
- package/heatmap/tooltip/index.d.ts.map +1 -0
- package/heatmap/tooltip/index.js +2 -0
- package/heatmap/tooltip/use-heatmap-item-tooltip.d.ts +22 -0
- package/heatmap/tooltip/use-heatmap-item-tooltip.d.ts.map +1 -0
- package/heatmap/tooltip/use-heatmap-item-tooltip.js +43 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -0
- package/package.json +1 -1
- package/scatter/scatter-chart.d.ts.map +1 -1
- package/scatter/scatter-chart.js +8 -4
package/README.md
CHANGED
|
@@ -182,6 +182,30 @@ Preview thumbnails for the chart examples in `assets/images/charts`. Each image
|
|
|
182
182
|
</tbody>
|
|
183
183
|
</table>
|
|
184
184
|
|
|
185
|
+
### Heatmap
|
|
186
|
+
|
|
187
|
+
<table>
|
|
188
|
+
<tbody>
|
|
189
|
+
<tr>
|
|
190
|
+
<td align="center">
|
|
191
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-heatmap--default" target="_blank">
|
|
192
|
+
<img src="assets/images/charts/heatmap/default.png" width="200" height="200" alt="Heatmap default" style="object-fit: contain;" /><br /><sub>default</sub>
|
|
193
|
+
</a>
|
|
194
|
+
</td>
|
|
195
|
+
<td align="center">
|
|
196
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-heatmap-labels--with-cell-labels" target="_blank">
|
|
197
|
+
<img src="assets/images/charts/heatmap/with-cell-labels.png" width="200" height="200" alt="Heatmap with cell labels" style="object-fit: contain;" /><br /><sub>with-cell-labels</sub>
|
|
198
|
+
</a>
|
|
199
|
+
</td>
|
|
200
|
+
<td align="center">
|
|
201
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-heatmap-colors--custom-colors" target="_blank">
|
|
202
|
+
<img src="assets/images/charts/heatmap/custom-colors.png" width="200" height="200" alt="Heatmap custom colors" style="object-fit: contain;" /><br /><sub>custom-colors</sub>
|
|
203
|
+
</a>
|
|
204
|
+
</td>
|
|
205
|
+
</tr>
|
|
206
|
+
</tbody>
|
|
207
|
+
</table>
|
|
208
|
+
|
|
185
209
|
### Gauge
|
|
186
210
|
|
|
187
211
|
<table>
|
package/area/area-chart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"area-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/area/area-chart.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAWzD,OAAO,KAAqC,MAAM,OAAO,CAAC;AAS1D,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,UAAU,GACX,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"area-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/area/area-chart.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAWzD,OAAO,KAAqC,MAAM,OAAO,CAAC;AAS1D,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,UAAU,GACX,MAAM,oBAAoB,CAAC;AAkgB5B,eAAO,MAAM,SAAS;;;;;;;CAEpB,CAAC"}
|
package/area/area-chart.js
CHANGED
|
@@ -7,7 +7,7 @@ import { GridComponent, LegendComponent, TooltipComponent } from 'echarts/compon
|
|
|
7
7
|
import * as echarts from 'echarts/core';
|
|
8
8
|
import React, { useEffect, useMemo, useRef } from 'react';
|
|
9
9
|
import { View } from 'react-native';
|
|
10
|
-
import { getAxis, valueAxisBoundsFromProps,
|
|
10
|
+
import { getAxis, valueAxisBoundsFromProps, categoryAxisBoundsFromProps } from '../axis';
|
|
11
11
|
import { echartsLegendLayoutFragment, mergeCartesianGridForLegend, } from '../legend/echarts-legend-layout';
|
|
12
12
|
// Register necessary components for this chart
|
|
13
13
|
echarts.use([
|
|
@@ -46,7 +46,7 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
46
46
|
});
|
|
47
47
|
// Derive smooth/step from type
|
|
48
48
|
const effectiveSmooth = type === 'smooth';
|
|
49
|
-
const effectiveStep = type === 'step' ? (step ?? 'start') :
|
|
49
|
+
const effectiveStep = type === 'step' ? (step ?? 'start') : false;
|
|
50
50
|
// Normalize data to array of { data: number[] } or { name: string; data: number[] }
|
|
51
51
|
const normalizedSeries = useMemo(() => {
|
|
52
52
|
let normalizedData = [];
|
|
@@ -89,25 +89,29 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
89
89
|
const len = normalizedSeries[0]?.data?.length ?? 0;
|
|
90
90
|
if (len === 0)
|
|
91
91
|
return normalizedSeries;
|
|
92
|
-
return normalizedSeries.map(s => {
|
|
92
|
+
return normalizedSeries.map((s) => {
|
|
93
93
|
const rawData = s.data;
|
|
94
94
|
const sumsAt = new Array(len).fill(0);
|
|
95
|
-
normalizedSeries.forEach((other
|
|
95
|
+
normalizedSeries.forEach((other) => {
|
|
96
96
|
const d = 'data' in other ? other.data : [];
|
|
97
|
-
d.forEach((v, i) => {
|
|
98
|
-
|
|
97
|
+
d.forEach((v, i) => {
|
|
98
|
+
if (i < len)
|
|
99
|
+
sumsAt[i] += typeof v === 'number' ? v : v[1];
|
|
100
|
+
});
|
|
99
101
|
});
|
|
100
102
|
const normalizedData = rawData.map((v, i) => {
|
|
103
|
+
const val = typeof v === 'number' ? v : v[1];
|
|
101
104
|
const sum = sumsAt[i] || 1;
|
|
102
|
-
return sum > 0 ? (
|
|
105
|
+
return sum > 0 ? (val / sum) * 100 : 0;
|
|
103
106
|
});
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
:
|
|
107
|
+
return {
|
|
108
|
+
name: s.name,
|
|
109
|
+
data: rawData.map((v, i) => [typeof v === 'number' ? String(i) : v[0], normalizedData[i]]),
|
|
110
|
+
};
|
|
107
111
|
});
|
|
108
112
|
}, [normalizedSeries, stackNormalize]);
|
|
109
113
|
const valueAxisBounds = useMemo(() => valueAxisBoundsFromProps({ minY, maxY, intervalY }), [minY, maxY, intervalY]);
|
|
110
|
-
const
|
|
114
|
+
const categoryAxisBounds = useMemo(() => categoryAxisBoundsFromProps({ minX, maxX, intervalX }), [minX, maxX, intervalX]);
|
|
111
115
|
const xAxisData = useMemo(() => {
|
|
112
116
|
const dataPoints = normalizedSeries
|
|
113
117
|
.map(s => s.data.map(item => item[0]))
|
|
@@ -130,6 +134,9 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
130
134
|
show: showXAxis || xAxisTickLabelFormatter != null,
|
|
131
135
|
color: theme.axis.x.tickLabelColor,
|
|
132
136
|
formatter: xAxisTickLabelFormatter ?? undefined,
|
|
137
|
+
...(categoryAxisBounds?.axisLabelInterval !== undefined
|
|
138
|
+
? { interval: categoryAxisBounds.axisLabelInterval }
|
|
139
|
+
: {}),
|
|
133
140
|
},
|
|
134
141
|
axisLine: showXAxis ? {
|
|
135
142
|
show: true,
|
|
@@ -155,7 +162,8 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
155
162
|
},
|
|
156
163
|
},
|
|
157
164
|
boundaryGap,
|
|
158
|
-
...(
|
|
165
|
+
...(categoryAxisBounds?.min !== undefined && { min: categoryAxisBounds.min }),
|
|
166
|
+
...(categoryAxisBounds?.max !== undefined && { max: categoryAxisBounds.max }),
|
|
159
167
|
};
|
|
160
168
|
// Build yAxis config (value axis: optional min/max/interval; else ECharts auto-scale, except stack-normalized %)
|
|
161
169
|
const yAxisConfig = {
|
|
@@ -348,7 +356,7 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
348
356
|
xAxisLabel,
|
|
349
357
|
yAxisLabel,
|
|
350
358
|
valueAxisBounds,
|
|
351
|
-
|
|
359
|
+
categoryAxisBounds,
|
|
352
360
|
]);
|
|
353
361
|
useEffect(() => {
|
|
354
362
|
let chart;
|
package/axis.d.ts
CHANGED
|
@@ -26,4 +26,17 @@ export declare function xAxisBoundsFromProps(params: {
|
|
|
26
26
|
max?: number;
|
|
27
27
|
interval?: number;
|
|
28
28
|
} | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Category-axis bounds: `min` / `max` on the axis; `intervalX` maps to `axisLabel.interval`
|
|
31
|
+
* (ECharts skips `interval` on category axes at the root).
|
|
32
|
+
*/
|
|
33
|
+
export declare function categoryAxisBoundsFromProps(params: {
|
|
34
|
+
minX?: number;
|
|
35
|
+
maxX?: number;
|
|
36
|
+
intervalX?: number;
|
|
37
|
+
}): {
|
|
38
|
+
min?: number;
|
|
39
|
+
max?: number;
|
|
40
|
+
axisLabelInterval?: number;
|
|
41
|
+
} | undefined;
|
|
29
42
|
//# sourceMappingURL=axis.d.ts.map
|
package/axis.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../../components/chart/axis.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,GAAI,YAAO,EAAE,YAAS,EAAE,WAAW,MAAM,aAUpE,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,EAAE,aAIrC,CAAA;AAiBD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAMhE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAMhE"}
|
|
1
|
+
{"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../../components/chart/axis.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,GAAI,YAAO,EAAE,YAAS,EAAE,WAAW,MAAM,aAUpE,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,EAAE,aAIrC,CAAA;AAiBD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAMhE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAMhE;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAYzE"}
|
package/axis.js
CHANGED
|
@@ -49,3 +49,23 @@ export function xAxisBoundsFromProps(params) {
|
|
|
49
49
|
interval: params.intervalX,
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Category-axis bounds: `min` / `max` on the axis; `intervalX` maps to `axisLabel.interval`
|
|
54
|
+
* (ECharts skips `interval` on category axes at the root).
|
|
55
|
+
*/
|
|
56
|
+
export function categoryAxisBoundsFromProps(params) {
|
|
57
|
+
const raw = xAxisBoundsFromProps(params);
|
|
58
|
+
if (!raw)
|
|
59
|
+
return undefined;
|
|
60
|
+
const { min, max, interval } = raw;
|
|
61
|
+
const out = {};
|
|
62
|
+
if (min !== undefined)
|
|
63
|
+
out.min = min;
|
|
64
|
+
if (max !== undefined)
|
|
65
|
+
out.max = max;
|
|
66
|
+
if (interval !== undefined) {
|
|
67
|
+
// intervalX step N → show every Nth category label (0, N, 2N, …)
|
|
68
|
+
out.axisLabelInterval = interval <= 1 ? 0 : interval - 1;
|
|
69
|
+
}
|
|
70
|
+
return Object.keys(out).length > 0 ? out : undefined;
|
|
71
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candlestick-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/candlestick/candlestick-chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAmB,MAAM,2BAA2B,CAAC;AASxF,OAAO,KAAqC,MAAM,OAAO,CAAC;AAK1D,YAAY,EAAE,qBAAqB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"candlestick-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/candlestick/candlestick-chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAmB,MAAM,2BAA2B,CAAC;AASxF,OAAO,KAAqC,MAAM,OAAO,CAAC;AAK1D,YAAY,EAAE,qBAAqB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AA4WzG,eAAO,MAAM,gBAAgB;;;;;;;CAE3B,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { BarChart, CandlestickChart as EChartsCandlestickChart, LineChart } from
|
|
|
5
5
|
import { GridComponent, LegendComponent, TooltipComponent, } from 'echarts/components';
|
|
6
6
|
import * as echarts from 'echarts/core';
|
|
7
7
|
import React, { useEffect, useMemo, useRef } from 'react';
|
|
8
|
-
import { valueAxisBoundsFromProps,
|
|
8
|
+
import { valueAxisBoundsFromProps, categoryAxisBoundsFromProps } from '../axis';
|
|
9
9
|
import { echartsLegendLayoutFragment } from '../legend/echarts-legend-layout';
|
|
10
10
|
echarts.use([
|
|
11
11
|
TooltipComponent,
|
|
@@ -34,7 +34,7 @@ const ChartComponent = ({ data, xAxisData, volumeData, ma5, ma10, ma20, width =
|
|
|
34
34
|
if (!data?.length)
|
|
35
35
|
return { series: [] };
|
|
36
36
|
const valueAxisBounds = valueAxisBoundsFromProps({ minY, maxY, intervalY });
|
|
37
|
-
const
|
|
37
|
+
const categoryAxisBounds = categoryAxisBoundsFromProps({ minX, maxX, intervalX });
|
|
38
38
|
const tooltipConfig = showHighlighter
|
|
39
39
|
? {
|
|
40
40
|
trigger: 'axis',
|
|
@@ -81,6 +81,9 @@ const ChartComponent = ({ data, xAxisData, volumeData, ma5, ma10, ma20, width =
|
|
|
81
81
|
show: showXAxis || xAxisTickLabelFormatter != null,
|
|
82
82
|
color: theme.axis.x.tickLabelColor,
|
|
83
83
|
formatter: xAxisTickLabelFormatter ?? undefined,
|
|
84
|
+
...(categoryAxisBounds?.axisLabelInterval !== undefined
|
|
85
|
+
? { interval: categoryAxisBounds.axisLabelInterval }
|
|
86
|
+
: {}),
|
|
84
87
|
},
|
|
85
88
|
axisLine: showXAxis
|
|
86
89
|
? { show: true, lineStyle: { color: theme.axis.x.lineColor, width: theme.axis.x.lineWidth } }
|
|
@@ -93,7 +96,8 @@ const ChartComponent = ({ data, xAxisData, volumeData, ma5, ma10, ma20, width =
|
|
|
93
96
|
show: showXAxisSplitLines,
|
|
94
97
|
lineStyle: { color: theme.axis.x.splitLineColor, width: theme.axis.x.splitLineWidth },
|
|
95
98
|
},
|
|
96
|
-
...(
|
|
99
|
+
...(categoryAxisBounds?.min !== undefined && { min: categoryAxisBounds.min }),
|
|
100
|
+
...(categoryAxisBounds?.max !== undefined && { max: categoryAxisBounds.max }),
|
|
97
101
|
};
|
|
98
102
|
if (hasVolume) {
|
|
99
103
|
xAxisMain.gridIndex = 0;
|
package/chart-container.js
CHANGED
|
@@ -26,7 +26,7 @@ const ChartContainer = ({ width = '100%', height = 350, data, noDataText = 'No d
|
|
|
26
26
|
height: typeof height === 'number' ? height : height,
|
|
27
27
|
};
|
|
28
28
|
return (<View style={[styles.container, containerStyle, style]} onLayout={handleLayout}>
|
|
29
|
-
{data ? (dimensions ? render(dimensions.width, dimensions.height) : null) : (<View style={[styles.noDataContainer, noDataContainerStyle, style]}>
|
|
29
|
+
{data !== undefined && data !== null ? (dimensions ? render(dimensions.width, dimensions.height) : null) : (<View style={[styles.noDataContainer, noDataContainerStyle, style]}>
|
|
30
30
|
<Text style={[styles.noDataText, noDataTextStyle]}>{noDataText}</Text>
|
|
31
31
|
</View>)}
|
|
32
32
|
</View>);
|
|
@@ -57,7 +57,7 @@ export const withResponsiveContainer = (Component, ...dataName) => {
|
|
|
57
57
|
height: height,
|
|
58
58
|
});
|
|
59
59
|
}, [props]);
|
|
60
|
-
const data = dataName.length > 0 ? dataName.find((name) =>
|
|
60
|
+
const data = dataName.length > 0 ? dataName.find((name) => props[name] !== undefined) || props.data : props.data;
|
|
61
61
|
return (<ChartContainer width={props.width} height={props.height} style={props.style} data={data} render={render} noDataText={props.noDataText}/>);
|
|
62
62
|
};
|
|
63
63
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/column/column-chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAS7D,OAAO,KAAqC,MAAM,OAAO,CAAC;AAW1D,oCAAoC;AACpC,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"column-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/column/column-chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAS7D,OAAO,KAAqC,MAAM,OAAO,CAAC;AAW1D,oCAAoC;AACpC,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AA0qB7D,eAAO,MAAM,WAAW;;;;;;;CAEtB,CAAC"}
|
package/column/column-chart.js
CHANGED
|
@@ -6,7 +6,7 @@ import { GridComponent, LegendComponent, TooltipComponent, } from 'echarts/compo
|
|
|
6
6
|
import * as echarts from 'echarts/core';
|
|
7
7
|
import React, { useEffect, useMemo, useRef } from 'react';
|
|
8
8
|
import { View } from 'react-native';
|
|
9
|
-
import { getAxis, valueAxisBoundsFromProps, xAxisBoundsFromProps } from '../axis';
|
|
9
|
+
import { getAxis, valueAxisBoundsFromProps, xAxisBoundsFromProps, categoryAxisBoundsFromProps } from '../axis';
|
|
10
10
|
import { createAxisTooltipPreset, useAxisTooltip } from '../cartesian/tooltip';
|
|
11
11
|
import { echartsLegendLayoutFragment, mergeCartesianGridForLegend, } from '../legend/echarts-legend-layout';
|
|
12
12
|
echarts.use([
|
|
@@ -119,6 +119,9 @@ const ChartComponent = ({ data, width = 220, height = 350, boundaryGap = true, c
|
|
|
119
119
|
}, [normalizedSeries, stackNormalize]);
|
|
120
120
|
const valueAxisBounds = useMemo(() => valueAxisBoundsFromProps({ minY, maxY, intervalY }), [minY, maxY, intervalY]);
|
|
121
121
|
const xAxisBounds = useMemo(() => xAxisBoundsFromProps({ minX, maxX, intervalX }), [minX, maxX, intervalX]);
|
|
122
|
+
const categoryAxisBounds = useMemo(() => horizontal
|
|
123
|
+
? categoryAxisBoundsFromProps({ minX: minY, maxX: maxY, intervalX: intervalY })
|
|
124
|
+
: categoryAxisBoundsFromProps({ minX, maxX, intervalX }), [horizontal, minX, maxX, intervalX, minY, maxY, intervalY]);
|
|
122
125
|
const showLabelInside = barInsideLabelFormatter != null;
|
|
123
126
|
const showLabelOutside = barOutsideLabelFormatter != null;
|
|
124
127
|
const isSingleSeries = displaySeries.length === 1;
|
|
@@ -137,43 +140,59 @@ const ChartComponent = ({ data, width = 220, height = 350, boundaryGap = true, c
|
|
|
137
140
|
const option = useMemo(() => {
|
|
138
141
|
const categories = (displaySeries[0]?.data ?? []).map((item) => String(item[0]));
|
|
139
142
|
const xAxisData = categoryAxisData;
|
|
143
|
+
const categoryShow = horizontal ? showYAxis : showXAxis;
|
|
144
|
+
const categoryShowTicks = horizontal ? showYAxisTicks : showXAxisTicks;
|
|
145
|
+
const categoryShowSplitLines = horizontal ? showYAxisSplitLines : showXAxisSplitLines;
|
|
146
|
+
const categoryTickFormatter = horizontal ? yAxisTickLabelFormatter : xAxisTickLabelFormatter;
|
|
147
|
+
const categoryAxisTheme = horizontal ? theme.axis.y : theme.axis.x;
|
|
148
|
+
const categoryAxisTitle = horizontal ? yAxisLabel : xAxisLabel;
|
|
149
|
+
const valueShow = horizontal ? showXAxis : showYAxis;
|
|
150
|
+
const valueShowTicks = horizontal ? showXAxisTicks : showYAxisTicks;
|
|
151
|
+
const valueShowSplitLines = horizontal ? showXAxisSplitLines : showYAxisSplitLines;
|
|
152
|
+
const valueTickFormatter = horizontal ? xAxisTickLabelFormatter : yAxisTickLabelFormatter;
|
|
153
|
+
const valueAxisTheme = horizontal ? theme.axis.x : theme.axis.y;
|
|
154
|
+
const valueAxisTitle = horizontal ? xAxisLabel : yAxisLabel;
|
|
140
155
|
const categoryAxisConfig = {
|
|
141
156
|
type: 'category',
|
|
142
157
|
data: xAxisData,
|
|
143
158
|
boundaryGap,
|
|
144
|
-
...(
|
|
145
|
-
...(
|
|
146
|
-
|
|
159
|
+
...(categoryAxisBounds?.min !== undefined && { min: categoryAxisBounds.min }),
|
|
160
|
+
...(categoryAxisBounds?.max !== undefined && { max: categoryAxisBounds.max }),
|
|
161
|
+
...(categoryAxisTitle != null && categoryAxisTitle !== '' && {
|
|
162
|
+
name: categoryAxisTitle,
|
|
147
163
|
nameLocation: 'middle',
|
|
148
164
|
nameGap: 25,
|
|
149
|
-
nameTextStyle: { color:
|
|
165
|
+
nameTextStyle: { color: categoryAxisTheme.tickLabelColor },
|
|
150
166
|
}),
|
|
151
167
|
axisLabel: {
|
|
152
|
-
show:
|
|
153
|
-
color:
|
|
154
|
-
formatter:
|
|
168
|
+
show: categoryShow || categoryTickFormatter != null,
|
|
169
|
+
color: categoryAxisTheme.tickLabelColor,
|
|
170
|
+
formatter: categoryTickFormatter ?? undefined,
|
|
171
|
+
...(categoryAxisBounds?.axisLabelInterval !== undefined
|
|
172
|
+
? { interval: categoryAxisBounds.axisLabelInterval }
|
|
173
|
+
: {}),
|
|
155
174
|
},
|
|
156
|
-
axisLine:
|
|
175
|
+
axisLine: categoryShow
|
|
157
176
|
? {
|
|
158
177
|
show: true,
|
|
159
178
|
lineStyle: {
|
|
160
|
-
color:
|
|
161
|
-
width:
|
|
179
|
+
color: categoryAxisTheme.lineColor,
|
|
180
|
+
width: categoryAxisTheme.lineWidth,
|
|
162
181
|
},
|
|
163
182
|
}
|
|
164
183
|
: { show: false },
|
|
165
184
|
axisTick: {
|
|
166
|
-
show:
|
|
185
|
+
show: categoryShow && categoryShowTicks,
|
|
167
186
|
lineStyle: {
|
|
168
|
-
color:
|
|
169
|
-
width:
|
|
187
|
+
color: categoryAxisTheme.tickColor,
|
|
188
|
+
width: categoryAxisTheme.tickWidth,
|
|
170
189
|
},
|
|
171
190
|
},
|
|
172
191
|
splitLine: {
|
|
173
|
-
show:
|
|
192
|
+
show: categoryShowSplitLines,
|
|
174
193
|
lineStyle: {
|
|
175
|
-
color:
|
|
176
|
-
width:
|
|
194
|
+
color: categoryAxisTheme.splitLineColor,
|
|
195
|
+
width: categoryAxisTheme.splitLineWidth,
|
|
177
196
|
},
|
|
178
197
|
},
|
|
179
198
|
};
|
|
@@ -181,46 +200,46 @@ const ChartComponent = ({ data, width = 220, height = 350, boundaryGap = true, c
|
|
|
181
200
|
const valueAxisNumericExtras = stackPct
|
|
182
201
|
? { min: 0, max: 100 }
|
|
183
202
|
: horizontal
|
|
184
|
-
?
|
|
203
|
+
? (xAxisBounds ?? {})
|
|
185
204
|
: (valueAxisBounds ?? {});
|
|
186
205
|
const valueAxisConfig = {
|
|
187
206
|
type: 'value',
|
|
188
207
|
...valueAxisNumericExtras,
|
|
189
|
-
...(
|
|
190
|
-
name:
|
|
208
|
+
...(valueAxisTitle != null && valueAxisTitle !== '' && {
|
|
209
|
+
name: valueAxisTitle,
|
|
191
210
|
nameLocation: 'middle',
|
|
192
211
|
nameGap: 40,
|
|
193
|
-
nameTextStyle: { color:
|
|
212
|
+
nameTextStyle: { color: valueAxisTheme.tickLabelColor },
|
|
194
213
|
}),
|
|
195
214
|
axisLabel: {
|
|
196
|
-
show:
|
|
197
|
-
color:
|
|
198
|
-
formatter:
|
|
215
|
+
show: valueShow || valueTickFormatter != null,
|
|
216
|
+
color: valueAxisTheme.tickLabelColor,
|
|
217
|
+
formatter: valueTickFormatter ??
|
|
199
218
|
(stackNormalize && displaySeries.length > 1
|
|
200
219
|
? (value) => `${value}%`
|
|
201
220
|
: undefined),
|
|
202
221
|
},
|
|
203
|
-
axisLine:
|
|
222
|
+
axisLine: valueShow
|
|
204
223
|
? {
|
|
205
224
|
show: true,
|
|
206
225
|
lineStyle: {
|
|
207
|
-
color:
|
|
208
|
-
width:
|
|
226
|
+
color: valueAxisTheme.lineColor,
|
|
227
|
+
width: valueAxisTheme.lineWidth,
|
|
209
228
|
},
|
|
210
229
|
}
|
|
211
230
|
: { show: false },
|
|
212
231
|
axisTick: {
|
|
213
|
-
show:
|
|
232
|
+
show: valueShow && valueShowTicks,
|
|
214
233
|
lineStyle: {
|
|
215
|
-
color:
|
|
216
|
-
width:
|
|
234
|
+
color: valueAxisTheme.tickColor,
|
|
235
|
+
width: valueAxisTheme.tickWidth,
|
|
217
236
|
},
|
|
218
237
|
},
|
|
219
238
|
splitLine: {
|
|
220
|
-
show:
|
|
239
|
+
show: valueShowSplitLines,
|
|
221
240
|
lineStyle: {
|
|
222
|
-
color:
|
|
223
|
-
width:
|
|
241
|
+
color: valueAxisTheme.splitLineColor,
|
|
242
|
+
width: valueAxisTheme.splitLineWidth,
|
|
224
243
|
},
|
|
225
244
|
},
|
|
226
245
|
};
|
|
@@ -462,6 +481,7 @@ const ChartComponent = ({ data, width = 220, height = 350, boundaryGap = true, c
|
|
|
462
481
|
yAxisLabel,
|
|
463
482
|
categoryAxisData,
|
|
464
483
|
valueAxisBounds,
|
|
484
|
+
categoryAxisBounds,
|
|
465
485
|
xAxisBounds,
|
|
466
486
|
]);
|
|
467
487
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"digital.gauge.d.ts","sourceRoot":"","sources":["../../../../../components/chart/gauge/digital/digital.gauge.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"digital.gauge.d.ts","sourceRoot":"","sources":["../../../../../components/chart/gauge/digital/digital.gauge.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAGpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;GAGG;AACH,UAAU,iBAAkB,SAAQ,cAAc;IAChD;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAyVD,eAAO,MAAM,YAAY;;;;;;;CAEvB,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { withResponsiveContainer } from '../../chart-container';
|
|
2
2
|
import { useChartTheme, withChartTheme } from '../../chart-theme.context';
|
|
3
|
-
import
|
|
3
|
+
import { getAxisByMinMax } from '../../axis';
|
|
4
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
5
|
import { useWindowDimensions } from 'react-native';
|
|
5
6
|
import Svg, { Defs, G, LinearGradient, Path, Stop, Text as SvgText } from 'react-native-svg';
|
|
6
7
|
// SVG Gauge Component
|
|
7
|
-
const SVGGaugeChart = ({ value, max = 100, showInnerArc = false, width, height, animationDuration = 1000, colors, axisBgColor: axisBgColorProp, axisWidth: axisWidthProp, tickColor: tickColorProp, }) => {
|
|
8
|
+
const SVGGaugeChart = ({ value, min = 0, max = 100, showInnerArc = false, width, height, animationDuration = 1000, colors, axisBgColor: axisBgColorProp, axisWidth: axisWidthProp, tickColor: tickColorProp, }) => {
|
|
8
9
|
const { theme: chartTheme } = useChartTheme(undefined, colors);
|
|
9
10
|
// Use theme colors; allow overrides from props
|
|
10
11
|
const gradientColors = chartTheme.series.map(item => item.color);
|
|
@@ -50,6 +51,13 @@ const SVGGaugeChart = ({ value, max = 100, showInnerArc = false, width, height,
|
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
}, [value, animationDuration]);
|
|
54
|
+
const { majorTickPositions, minorStep } = useMemo(() => {
|
|
55
|
+
const scaleRange = Math.max(max - min, 1);
|
|
56
|
+
const majors = getAxisByMinMax(min, max);
|
|
57
|
+
const majorInterval = majors.length >= 2 ? majors[1] - majors[0] : Math.max(scaleRange / 5, 1);
|
|
58
|
+
const step = Math.max(1, Math.round(majorInterval / 10));
|
|
59
|
+
return { majorTickPositions: majors, minorStep: step };
|
|
60
|
+
}, [min, max]);
|
|
53
61
|
// If height not provided, use 90% of available height
|
|
54
62
|
// If width not provided, use the same as height to keep it square
|
|
55
63
|
const calculatedHeight = height ?? dimensions.height * 0.9;
|
|
@@ -62,7 +70,9 @@ const SVGGaugeChart = ({ value, max = 100, showInnerArc = false, width, height,
|
|
|
62
70
|
const startAngle = -135;
|
|
63
71
|
const endAngle = 135;
|
|
64
72
|
const totalAngle = endAngle - startAngle;
|
|
65
|
-
const
|
|
73
|
+
const scaleRange = Math.max(max - min, 1);
|
|
74
|
+
const normalizedValue = (animatedValue - min) / scaleRange;
|
|
75
|
+
const percentage = normalizedValue * 100;
|
|
66
76
|
const valueAngle = (percentage / 100) * totalAngle;
|
|
67
77
|
const polarToCartesian = (centerX, centerY, radius, angleInDegrees) => {
|
|
68
78
|
const angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0;
|
|
@@ -130,18 +140,18 @@ const SVGGaugeChart = ({ value, max = 100, showInnerArc = false, width, height,
|
|
|
130
140
|
}
|
|
131
141
|
ticks.push(<Path key={i} d={`M ${outerPoint.x} ${outerPoint.y} L ${innerPoint.x} ${innerPoint.y}`} stroke={tickColor} strokeWidth={tickStrokeWidth} strokeLinecap="round"/>);
|
|
132
142
|
}
|
|
133
|
-
// Generate scale labels and inner ticks
|
|
143
|
+
// Generate scale labels and inner ticks from min/max
|
|
134
144
|
const scaleLabels = [];
|
|
135
145
|
const innerTicks = [];
|
|
136
|
-
const majorTickPositions = [0, 20, 40, 60, 80, 100];
|
|
137
146
|
const labelRadius = radius - 40;
|
|
138
147
|
const innerTickLength = 4;
|
|
139
148
|
const minorTickLength = 2;
|
|
140
149
|
const gapFromOuterTicks = 4; // Gap between outer and inner elements
|
|
141
150
|
const innerTickOuterRadius = radius - outerTickLength - gapFromOuterTicks;
|
|
151
|
+
const majorTickSet = new Set(majorTickPositions);
|
|
142
152
|
// Add major ticks and labels
|
|
143
153
|
for (const labelValue of majorTickPositions) {
|
|
144
|
-
const labelAngle = startAngle + (labelValue /
|
|
154
|
+
const labelAngle = startAngle + ((labelValue - min) / scaleRange) * totalAngle;
|
|
145
155
|
const labelPosition = polarToCartesian(center, center, labelRadius, labelAngle);
|
|
146
156
|
// Add scale label
|
|
147
157
|
scaleLabels.push(<SvgText key={`label-${labelValue}`} x={labelPosition.x} y={labelPosition.y} textAnchor="middle" fontSize="12" fill={labelColor}>
|
|
@@ -152,17 +162,14 @@ const SVGGaugeChart = ({ value, max = 100, showInnerArc = false, width, height,
|
|
|
152
162
|
const tickInnerPoint = polarToCartesian(center, center, innerTickOuterRadius - innerTickLength, labelAngle);
|
|
153
163
|
innerTicks.push(<Path key={`inner-tick-${labelValue}`} d={`M ${tickOuterPoint.x} ${tickOuterPoint.y} L ${tickInnerPoint.x} ${tickInnerPoint.y}`} stroke={innerTickColor} strokeWidth={2} strokeLinecap="round"/>);
|
|
154
164
|
}
|
|
155
|
-
//
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
for (let value = 0; value <= max; value += 2) {
|
|
159
|
-
// Skip if this is a major tick position
|
|
160
|
-
if (majorTickPositions.includes(value))
|
|
165
|
+
// Minor ticks between major labels
|
|
166
|
+
for (let tickValue = min; tickValue <= max; tickValue += minorStep) {
|
|
167
|
+
if (majorTickSet.has(tickValue))
|
|
161
168
|
continue;
|
|
162
|
-
const tickAngle = startAngle + (
|
|
169
|
+
const tickAngle = startAngle + ((tickValue - min) / scaleRange) * totalAngle;
|
|
163
170
|
const tickOuterPoint = polarToCartesian(center, center, innerTickOuterRadius, tickAngle);
|
|
164
171
|
const tickInnerPoint = polarToCartesian(center, center, innerTickOuterRadius - minorTickLength, tickAngle);
|
|
165
|
-
innerTicks.push(<Path key={`inner-minor-tick-${
|
|
172
|
+
innerTicks.push(<Path key={`inner-minor-tick-${tickValue}`} d={`M ${tickOuterPoint.x} ${tickOuterPoint.y} L ${tickInnerPoint.x} ${tickInnerPoint.y}`} stroke={inactiveTickColor} strokeWidth={1} strokeLinecap="round"/>);
|
|
166
173
|
}
|
|
167
174
|
// Calculate the animated end angle for the outer arc
|
|
168
175
|
const animatedEndAngle = startAngle + valueAngle;
|
|
@@ -205,8 +212,8 @@ const SVGGaugeChart = ({ value, max = 100, showInnerArc = false, width, height,
|
|
|
205
212
|
</SvgText>
|
|
206
213
|
</Svg>);
|
|
207
214
|
};
|
|
208
|
-
const ChartComponent = ({ value = 46, min = 0, max =
|
|
209
|
-
return (<SVGGaugeChart value={value} max={max} width={width} height={height} colors={props.colors} axisBgColor={axisBgColor} axisWidth={axisWidth} tickColor={tickColor} showInnerArc={showInnerArc} animationDuration={animationDuration}/>);
|
|
215
|
+
const ChartComponent = ({ value = 46, min = 0, max = 100, width, height, axisBgColor, axisWidth, tickColor, showInnerArc, animationDuration, ...props }) => {
|
|
216
|
+
return (<SVGGaugeChart value={value} min={min} max={max} width={width} height={height} colors={props.colors} axisBgColor={axisBgColor} axisWidth={axisWidth} tickColor={tickColor} showInnerArc={showInnerArc} animationDuration={animationDuration}/>);
|
|
210
217
|
};
|
|
211
218
|
export const DigitalGauge = Object.assign(withResponsiveContainer(withChartTheme(ChartComponent), 'value'), {
|
|
212
219
|
displayName: 'DigitalGauge',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radial.gauge.d.ts","sourceRoot":"","sources":["../../../../../components/chart/gauge/radial/radial.gauge.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"radial.gauge.d.ts","sourceRoot":"","sources":["../../../../../components/chart/gauge/radial/radial.gauge.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAUrD;;;GAGG;AACH,UAAU,gBAAiB,SAAQ,cAAc;CAAG;AA8RpD,eAAO,MAAM,WAAW;;;;;;;CAEtB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { withResponsiveContainer } from '../../chart-container';
|
|
2
2
|
import { useChartTheme, withChartTheme } from '../../chart-theme.context';
|
|
3
|
+
import { getAxisByMinMax } from '../../axis';
|
|
3
4
|
import { SkiaChart, SkiaRenderer } from '@wuba/react-native-echarts';
|
|
4
5
|
import { BarChart } from 'echarts/charts';
|
|
5
6
|
import { GaugeChart } from 'echarts/charts';
|
|
@@ -32,6 +33,7 @@ const ChartComponent = ({ value, min = 0, max = 100, width = 220, height = 240,
|
|
|
32
33
|
radius: [innerRadius, outerRadius],
|
|
33
34
|
},
|
|
34
35
|
angleAxis: {
|
|
36
|
+
min: min,
|
|
35
37
|
max: max,
|
|
36
38
|
startAngle: 225,
|
|
37
39
|
endAngle: -45,
|
|
@@ -46,7 +48,7 @@ const ChartComponent = ({ value, min = 0, max = 100, width = 220, height = 240,
|
|
|
46
48
|
series: [
|
|
47
49
|
{
|
|
48
50
|
type: 'bar',
|
|
49
|
-
data: [max],
|
|
51
|
+
data: [max - min],
|
|
50
52
|
coordinateSystem: 'polar',
|
|
51
53
|
name: 'Background',
|
|
52
54
|
tooltip: {
|
|
@@ -64,7 +66,7 @@ const ChartComponent = ({ value, min = 0, max = 100, width = 220, height = 240,
|
|
|
64
66
|
},
|
|
65
67
|
{
|
|
66
68
|
type: 'bar',
|
|
67
|
-
data: [value],
|
|
69
|
+
data: [Math.max(value - min, 0)],
|
|
68
70
|
coordinateSystem: 'polar',
|
|
69
71
|
name: 'Value',
|
|
70
72
|
itemStyle: {
|
|
@@ -79,7 +81,7 @@ const ChartComponent = ({ value, min = 0, max = 100, width = 220, height = 240,
|
|
|
79
81
|
},
|
|
80
82
|
]
|
|
81
83
|
};
|
|
82
|
-
}, [chartTheme, value, max, width, height, axisBgColorProp]);
|
|
84
|
+
}, [chartTheme, value, min, max, width, height, axisBgColorProp]);
|
|
83
85
|
// Gauge option (progressArcOption)
|
|
84
86
|
const gaugeOption = useMemo(() => {
|
|
85
87
|
// Gauge radius smaller than radial inner ring to create a gap
|
|
@@ -94,6 +96,8 @@ const ChartComponent = ({ value, min = 0, max = 100, width = 220, height = 240,
|
|
|
94
96
|
const anchorBorderColor = tickColorProp ?? chartTheme.axis.r.tickColor;
|
|
95
97
|
const valueColor = chartTheme.axis.r.tickLabelColor;
|
|
96
98
|
const unitColor = chartTheme.axis.r.tickLabelColor;
|
|
99
|
+
const majorTicks = getAxisByMinMax(min, max);
|
|
100
|
+
const splitNumber = Math.max(majorTicks.length - 1, 1);
|
|
97
101
|
return {
|
|
98
102
|
series: [
|
|
99
103
|
{
|
|
@@ -104,7 +108,7 @@ const ChartComponent = ({ value, min = 0, max = 100, width = 220, height = 240,
|
|
|
104
108
|
endAngle: -45,
|
|
105
109
|
min: min,
|
|
106
110
|
max: max,
|
|
107
|
-
splitNumber
|
|
111
|
+
splitNumber,
|
|
108
112
|
axisLine: {
|
|
109
113
|
show: false,
|
|
110
114
|
distance: 1,
|
|
@@ -144,12 +148,7 @@ const ChartComponent = ({ value, min = 0, max = 100, width = 220, height = 240,
|
|
|
144
148
|
distance: 16,
|
|
145
149
|
fontSize: 12,
|
|
146
150
|
color: labelColor,
|
|
147
|
-
formatter:
|
|
148
|
-
if (value === 20 || value === 80) {
|
|
149
|
-
return value.toString();
|
|
150
|
-
}
|
|
151
|
-
return '';
|
|
152
|
-
},
|
|
151
|
+
formatter: (tickValue) => String(Math.round(tickValue)),
|
|
153
152
|
},
|
|
154
153
|
anchor: {
|
|
155
154
|
show: true,
|
|
@@ -165,9 +164,7 @@ const ChartComponent = ({ value, min = 0, max = 100, width = 220, height = 240,
|
|
|
165
164
|
},
|
|
166
165
|
detail: {
|
|
167
166
|
valueAnimation: true,
|
|
168
|
-
formatter:
|
|
169
|
-
return '{value|' + Math.round(value) + '}{unit|/100}';
|
|
170
|
-
},
|
|
167
|
+
formatter: (detailValue) => `{value|${Math.round(detailValue)}}{unit|/${max}}`,
|
|
171
168
|
offsetCenter: [0, '70%'],
|
|
172
169
|
rich: {
|
|
173
170
|
value: {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HeatmapChartProps } from './heatmap-chart.props';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
/** common -> heatmap */
|
|
4
|
+
export type { HeatmapChartProps, HeatmapDataPoint, HeatmapChartSelectEvent, } from './heatmap-chart.props';
|
|
5
|
+
export declare const HeatmapChart: ((props: HeatmapChartProps & {
|
|
6
|
+
theme?: Partial<import("..").ChartTheme>;
|
|
7
|
+
} & {
|
|
8
|
+
width?: number | string;
|
|
9
|
+
height?: number | string;
|
|
10
|
+
}) => React.JSX.Element) & {
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=heatmap-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heatmap-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/heatmap/heatmap-chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAA2B,MAAM,uBAAuB,CAAC;AASxF,OAAO,KAAqC,MAAM,OAAO,CAAC;AAM1D,wBAAwB;AACxB,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAgQ/B,eAAO,MAAM,YAAY;;;;;;;CAEvB,CAAC"}
|