lowcoder-map-component 0.1.1
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 +37 -0
- package/icons/demo-icon.svg +10 -0
- package/icons/hills.svg +17 -0
- package/index.css +27 -0
- package/index.html +35 -0
- package/index.tsx +20 -0
- package/loader.mjs +11 -0
- package/package.json +175 -0
- package/src/README.md +35 -0
- package/src/components/ChartPropertyView.tsx +961 -0
- package/src/components/SeriesComp.tsx +368 -0
- package/src/components/TabPropertyView.tsx +127 -0
- package/src/comps/Barcharts/comp.tsx +338 -0
- package/src/comps/Barcharts/constants.tsx +77 -0
- package/src/comps/Linecharts/comp.tsx +350 -0
- package/src/comps/Linecharts/constants.tsx +53 -0
- package/src/comps/Linechartsv2/comp.tsx +350 -0
- package/src/comps/Linechartsv2/constants.tsx +68 -0
- package/src/comps/Mapcharts/comp.tsx +381 -0
- package/src/comps/Mapcharts/constants.tsx +312 -0
- package/src/comps/Mapchartsv2/comp.tsx +393 -0
- package/src/comps/Mapchartsv2/constants.tsx +340 -0
- package/src/comps/MixedLineBarCharts/comp.tsx +353 -0
- package/src/comps/MixedLineBarCharts/constants.tsx +60 -0
- package/src/comps/MultiLineCharts/comp.tsx +362 -0
- package/src/comps/MultiLineCharts/constants.tsx +96 -0
- package/src/comps/PercentageCharts/comp.tsx +359 -0
- package/src/comps/PercentageCharts/constants.tsx +98 -0
- package/src/comps/Piecharts/comp.tsx +334 -0
- package/src/comps/Piecharts/constants.tsx +48 -0
- package/src/comps/Tablecharts/comp.tsx +429 -0
- package/src/comps/Tablecharts/constants.tsx +97 -0
- package/src/comps/Totalcharts/comp.tsx +463 -0
- package/src/comps/Totalcharts/constants.tsx +66 -0
- package/src/comps/TwoLineCharts/comp.tsx +350 -0
- package/src/comps/TwoLineCharts/constants.tsx +82 -0
- package/src/comps/mapComponent/comp.tsx +338 -0
- package/src/comps/mapComponent/constants.tsx +2149 -0
- package/src/comps/tab/comp.tsx +283 -0
- package/src/comps/tab/constants.tsx +79 -0
- package/src/configs/barChartConfig.tsx +153 -0
- package/src/configs/baseConfig.tsx +66 -0
- package/src/configs/candleStickChartConfig.tsx +35 -0
- package/src/configs/cartesianAxisConfig.tsx +314 -0
- package/src/configs/chartUrls.tsx +9 -0
- package/src/configs/echartConfig.tsx +260 -0
- package/src/configs/echartsLabelConfig.tsx +47 -0
- package/src/configs/echartsLegendConfig.tsx +29 -0
- package/src/configs/echartsTitleConfig.tsx +49 -0
- package/src/configs/echartsTitleVerticalConfig.tsx +50 -0
- package/src/configs/funnelChartConfig.tsx +35 -0
- package/src/configs/gaugeChartConfig.tsx +31 -0
- package/src/configs/graphChartConfig.tsx +31 -0
- package/src/configs/heatmapChartConfig.tsx +31 -0
- package/src/configs/legendConfig.tsx +55 -0
- package/src/configs/lineChartConfig.tsx +246 -0
- package/src/configs/lineChartConfigv2.tsx +246 -0
- package/src/configs/mapChartConfig.tsx +106 -0
- package/src/configs/mapChartConfigv2.tsx +106 -0
- package/src/configs/mixedChartConfig.tsx +21 -0
- package/src/configs/pieChartConfig.tsx +156 -0
- package/src/configs/radarChartConfig.tsx +31 -0
- package/src/configs/sankeyChartConfig.tsx +35 -0
- package/src/configs/scatterChartConfig.tsx +152 -0
- package/src/configs/sunburstChartConfig.tsx +31 -0
- package/src/configs/tabConfig.tsx +0 -0
- package/src/configs/tableChartConfig.tsx +81 -0
- package/src/configs/themeriverChartConfig.tsx +31 -0
- package/src/configs/totalChartConfig.tsx +670 -0
- package/src/configs/treeChartConfig.tsx +31 -0
- package/src/configs/treemapChartConfig.tsx +31 -0
- package/src/controls/AnimationsControls.tsx +3 -0
- package/src/controls/AutoHeightControl.tsx +2 -0
- package/src/controls/AxisControls.tsx +146 -0
- package/src/controls/AxisVisibilityControl.tsx +14 -0
- package/src/controls/ChartTypeControl.tsx +15 -0
- package/src/controls/ColorScaleControl.tsx +221 -0
- package/src/controls/ColumnControl.tsx +204 -0
- package/src/controls/ConfigControl.tsx +37 -0
- package/src/controls/DirectionControls.tsx +20 -0
- package/src/controls/IconControl.tsx +88 -0
- package/src/controls/LegendControl.tsx +8 -0
- package/src/controls/RowLimitControl.tsx +91 -0
- package/src/controls/StyleControls.tsx +22 -0
- package/src/controls/TimeControls.tsx +41 -0
- package/src/controls/TrendlineControl.tsx +89 -0
- package/src/controls/UIEventControl.tsx +21 -0
- package/src/controls/index.ts +16 -0
- package/src/controls/radioControl.tsx +88 -0
- package/src/exposing/index.ts +3 -0
- package/src/exposing/setPoint.ts +19 -0
- package/src/geo/vn.geo.json +369897 -0
- package/src/geo/world.geo.json +32127 -0
- package/src/i18n/comps/index.tsx +39 -0
- package/src/i18n/comps/locales/en.ts +558 -0
- package/src/i18n/comps/locales/enObj.tsx +7186 -0
- package/src/i18n/comps/locales/index.ts +7 -0
- package/src/i18n/comps/locales/pt.ts +37 -0
- package/src/i18n/comps/locales/ptObj.tsx +40 -0
- package/src/i18n/comps/locales/types.tsx +622 -0
- package/src/i18n/comps/locales/zh.ts +3 -0
- package/src/i18n/comps/locales/zhObj.tsx +4 -0
- package/src/index.ts +31 -0
- package/src/types/global.d.ts +9 -0
- package/src/types/lowcoder-sdk.d.ts +578 -0
- package/src/utils/chartStyle.util.ts +121 -0
- package/src/utils/columnExtractor.util.ts +41 -0
- package/src/utils/dataTransform.util.ts +37 -0
- package/src/utils/deepEqual.util.ts +29 -0
- package/src/utils/echarts.util.tsx +822 -0
- package/src/utils/getDataKey.util.ts +115 -0
- package/src/utils/getLinearRegression.util.ts +46 -0
- package/src/utils/googleMaps.util.ts +28 -0
- package/src/utils/isEmpty.util.ts +10 -0
- package/src/utils/move.util.ts +6 -0
- package/src/utils/selection.util.ts +73 -0
- package/src/utils/style.util.ts +315 -0
- package/src/utils/time.util.ts +221 -0
- package/src/utils/timeFormatter.util.ts +104 -0
- package/src/utils/timeProcessing.util.ts +38 -0
- package/src/utils/trendline.util.ts +342 -0
- package/tsconfig.json +25 -0
- package/vite.config.js +19 -0
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
import { IconControl } from "@/controls/IconControl";
|
|
2
|
+
import TrendlineControl from "@/controls/TrendlineControl";
|
|
3
|
+
import { trans } from "@/i18n/comps";
|
|
4
|
+
import { Flex } from "antd";
|
|
5
|
+
import { LineSeriesOption } from "echarts";
|
|
6
|
+
import {
|
|
7
|
+
BoolControl,
|
|
8
|
+
ColorControl,
|
|
9
|
+
dropdownControl,
|
|
10
|
+
EchartDefaultChartStyle,
|
|
11
|
+
jsonControl,
|
|
12
|
+
MultiCompBuilder,
|
|
13
|
+
NumberControl,
|
|
14
|
+
showLabelPropertyView,
|
|
15
|
+
StringControl,
|
|
16
|
+
styleControl,
|
|
17
|
+
toArray,
|
|
18
|
+
withDefault,
|
|
19
|
+
} from "lowcoder-sdk";
|
|
20
|
+
import React from "react";
|
|
21
|
+
import {
|
|
22
|
+
BorderTypeOptions,
|
|
23
|
+
ItemColorComp,
|
|
24
|
+
SymbolOptions,
|
|
25
|
+
} from "./lineChartConfig";
|
|
26
|
+
|
|
27
|
+
export const DataTypeOptions = [
|
|
28
|
+
{
|
|
29
|
+
label: trans("totalChart.number"),
|
|
30
|
+
value: "number",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: trans("totalChart.string"),
|
|
34
|
+
value: "string",
|
|
35
|
+
},
|
|
36
|
+
] as const;
|
|
37
|
+
|
|
38
|
+
export const CurrencyOptions = [
|
|
39
|
+
{
|
|
40
|
+
label: "%",
|
|
41
|
+
value: "percent",
|
|
42
|
+
description: "Phần trăm",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: "$",
|
|
46
|
+
value: "usd",
|
|
47
|
+
description: "Đô la Mỹ",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: "€",
|
|
51
|
+
value: "eur",
|
|
52
|
+
description: "Euro",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: "¥",
|
|
56
|
+
value: "jpy",
|
|
57
|
+
description: "Yên Nhật",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: "£",
|
|
61
|
+
value: "gbp",
|
|
62
|
+
description: "Bảng Anh",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
label: "₩",
|
|
66
|
+
value: "krw",
|
|
67
|
+
description: "Won Hàn Quốc",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
label: "VNĐ",
|
|
71
|
+
value: "vnd",
|
|
72
|
+
description: "Đồng Việt Nam",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: "฿",
|
|
76
|
+
value: "thb",
|
|
77
|
+
description: "Baht Thái",
|
|
78
|
+
},
|
|
79
|
+
] as const;
|
|
80
|
+
|
|
81
|
+
export const UnitOptions = [
|
|
82
|
+
{
|
|
83
|
+
label: "cái",
|
|
84
|
+
value: "unit",
|
|
85
|
+
description: "Đơn vị",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
label: "văn bản",
|
|
89
|
+
value: "document",
|
|
90
|
+
description: "Đếm",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: "từ",
|
|
94
|
+
value: "text",
|
|
95
|
+
description: "Đếm",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
label: "số",
|
|
99
|
+
value: "number",
|
|
100
|
+
description: "Đếm",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
label: "kg",
|
|
104
|
+
value: "kg",
|
|
105
|
+
description: "Kilogram",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
label: "g",
|
|
109
|
+
value: "gram",
|
|
110
|
+
description: "Gram",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
label: "l",
|
|
114
|
+
value: "liter",
|
|
115
|
+
description: "Lít",
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
label: "m",
|
|
119
|
+
value: "meter",
|
|
120
|
+
description: "Mét",
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
label: "cm",
|
|
124
|
+
value: "centimeter",
|
|
125
|
+
description: "Centimet",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
label: "m²",
|
|
129
|
+
value: "square_meter",
|
|
130
|
+
description: "Mét vuông",
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
label: "m³",
|
|
134
|
+
value: "cubic_meter",
|
|
135
|
+
description: "Mét khối",
|
|
136
|
+
},
|
|
137
|
+
] as const;
|
|
138
|
+
|
|
139
|
+
export const TimeOptions = [
|
|
140
|
+
{
|
|
141
|
+
label: "giờ",
|
|
142
|
+
value: "hour",
|
|
143
|
+
description: "Giờ",
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
label: "ngày",
|
|
147
|
+
value: "day",
|
|
148
|
+
description: "Ngày",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
label: "tuần",
|
|
152
|
+
value: "week",
|
|
153
|
+
description: "Tuần",
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
label: "tháng",
|
|
157
|
+
value: "month",
|
|
158
|
+
description: "Tháng",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
label: "năm",
|
|
162
|
+
value: "year",
|
|
163
|
+
description: "Năm",
|
|
164
|
+
},
|
|
165
|
+
] as const;
|
|
166
|
+
|
|
167
|
+
export const AllUnitOptions = [
|
|
168
|
+
...CurrencyOptions,
|
|
169
|
+
...UnitOptions,
|
|
170
|
+
...TimeOptions,
|
|
171
|
+
{
|
|
172
|
+
label: "Mặc định",
|
|
173
|
+
value: "",
|
|
174
|
+
description: "Mặc định",
|
|
175
|
+
},
|
|
176
|
+
] as const;
|
|
177
|
+
|
|
178
|
+
export type UnitOptionValue = (typeof AllUnitOptions)[number]["value"];
|
|
179
|
+
|
|
180
|
+
export const formatValue = (
|
|
181
|
+
value: React.ReactNode,
|
|
182
|
+
option: UnitOptionValue,
|
|
183
|
+
unit?: React.ReactNode
|
|
184
|
+
): React.ReactNode => {
|
|
185
|
+
const formatters: Record<
|
|
186
|
+
UnitOptionValue,
|
|
187
|
+
(val: React.ReactNode, unit?: React.ReactNode) => React.ReactNode
|
|
188
|
+
> = {
|
|
189
|
+
"": (val, unit) => (
|
|
190
|
+
<span className="statistic">
|
|
191
|
+
<span className="total">{val}</span>{" "}
|
|
192
|
+
<span className="unit">{unit}</span>
|
|
193
|
+
</span>
|
|
194
|
+
),
|
|
195
|
+
percent: (val) => (
|
|
196
|
+
<span className="statistic">
|
|
197
|
+
<span className="total">{val}</span>
|
|
198
|
+
<span className="unit">%</span>
|
|
199
|
+
</span>
|
|
200
|
+
),
|
|
201
|
+
usd: (val) => (
|
|
202
|
+
<span className="statistic">
|
|
203
|
+
<span className="unit">$</span>
|
|
204
|
+
<span className="total">{val}</span>
|
|
205
|
+
</span>
|
|
206
|
+
),
|
|
207
|
+
eur: (val) => (
|
|
208
|
+
<span className="statistic">
|
|
209
|
+
<span className="unit">€</span>
|
|
210
|
+
<span className="total">{val}</span>
|
|
211
|
+
</span>
|
|
212
|
+
),
|
|
213
|
+
jpy: (val) => (
|
|
214
|
+
<span className="statistic">
|
|
215
|
+
<span className="unit">¥</span>
|
|
216
|
+
<span className="total">{val}</span>
|
|
217
|
+
</span>
|
|
218
|
+
),
|
|
219
|
+
gbp: (val) => (
|
|
220
|
+
<span className="statistic">
|
|
221
|
+
<span className="unit">£</span>
|
|
222
|
+
<span className="total">{val}</span>
|
|
223
|
+
</span>
|
|
224
|
+
),
|
|
225
|
+
krw: (val) => (
|
|
226
|
+
<span className="statistic">
|
|
227
|
+
<span className="unit">₩</span>
|
|
228
|
+
<span className="total">{val}</span>
|
|
229
|
+
</span>
|
|
230
|
+
),
|
|
231
|
+
vnd: (val) => (
|
|
232
|
+
<span className="statistic">
|
|
233
|
+
<span className="total">{val}</span> <span className="unit">VNĐ</span>
|
|
234
|
+
</span>
|
|
235
|
+
),
|
|
236
|
+
thb: (val) => (
|
|
237
|
+
<span className="statistic">
|
|
238
|
+
<span className="unit">฿</span>
|
|
239
|
+
<span className="total">{val}</span>
|
|
240
|
+
</span>
|
|
241
|
+
),
|
|
242
|
+
unit: (val) => (
|
|
243
|
+
<span className="statistic">
|
|
244
|
+
<span className="total">{val}</span> <span className="unit">cái</span>
|
|
245
|
+
</span>
|
|
246
|
+
),
|
|
247
|
+
document: (val) => (
|
|
248
|
+
<span className="statistic">
|
|
249
|
+
<span className="total">{val}</span>{" "}
|
|
250
|
+
<span className="unit">văn bản</span>
|
|
251
|
+
</span>
|
|
252
|
+
),
|
|
253
|
+
text: (val) => (
|
|
254
|
+
<span className="statistic">
|
|
255
|
+
<span className="total">{val}</span> <span className="unit">từ</span>
|
|
256
|
+
</span>
|
|
257
|
+
),
|
|
258
|
+
number: (val) => (
|
|
259
|
+
<span className="statistic">
|
|
260
|
+
<span className="total">{val}</span> <span className="unit">số</span>
|
|
261
|
+
</span>
|
|
262
|
+
),
|
|
263
|
+
kg: (val) => (
|
|
264
|
+
<span className="statistic">
|
|
265
|
+
<span className="total">{val}</span> <span className="unit">kg</span>
|
|
266
|
+
</span>
|
|
267
|
+
),
|
|
268
|
+
gram: (val) => (
|
|
269
|
+
<span className="statistic">
|
|
270
|
+
<span className="total">{val}</span> <span className="unit">g</span>
|
|
271
|
+
</span>
|
|
272
|
+
),
|
|
273
|
+
liter: (val) => (
|
|
274
|
+
<span className="statistic">
|
|
275
|
+
<span className="total">{val}</span> <span className="unit">l</span>
|
|
276
|
+
</span>
|
|
277
|
+
),
|
|
278
|
+
meter: (val) => (
|
|
279
|
+
<span className="statistic">
|
|
280
|
+
<span className="total">{val}</span> <span className="unit">m</span>
|
|
281
|
+
</span>
|
|
282
|
+
),
|
|
283
|
+
centimeter: (val) => (
|
|
284
|
+
<span className="statistic">
|
|
285
|
+
<span className="total">{val}</span> <span className="unit">cm</span>
|
|
286
|
+
</span>
|
|
287
|
+
),
|
|
288
|
+
square_meter: (val) => (
|
|
289
|
+
<span className="statistic">
|
|
290
|
+
<span className="total">{val}</span> <span className="unit">m²</span>
|
|
291
|
+
</span>
|
|
292
|
+
),
|
|
293
|
+
cubic_meter: (val) => (
|
|
294
|
+
<span className="statistic">
|
|
295
|
+
<span className="total">{val}</span> <span className="unit">m³</span>
|
|
296
|
+
</span>
|
|
297
|
+
),
|
|
298
|
+
hour: (val) => (
|
|
299
|
+
<span className="statistic">
|
|
300
|
+
<span className="total">{val}</span> <span className="unit">giờ</span>
|
|
301
|
+
</span>
|
|
302
|
+
),
|
|
303
|
+
day: (val) => (
|
|
304
|
+
<span className="statistic">
|
|
305
|
+
<span className="total">{val}</span> <span className="unit">ngày</span>
|
|
306
|
+
</span>
|
|
307
|
+
),
|
|
308
|
+
week: (val) => (
|
|
309
|
+
<span className="statistic">
|
|
310
|
+
<span className="total">{val}</span> <span className="unit">tuần</span>
|
|
311
|
+
</span>
|
|
312
|
+
),
|
|
313
|
+
month: (val) => (
|
|
314
|
+
<span className="statistic">
|
|
315
|
+
<span className="total">{val}</span> <span className="unit">tháng</span>
|
|
316
|
+
</span>
|
|
317
|
+
),
|
|
318
|
+
year: (val) => (
|
|
319
|
+
<span className="statistic">
|
|
320
|
+
<span className="total">{val}</span> <span className="unit">năm</span>
|
|
321
|
+
</span>
|
|
322
|
+
),
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
return formatters[option]?.(value, unit);
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export const CompStyles = [
|
|
329
|
+
{
|
|
330
|
+
name: "backgroundColor",
|
|
331
|
+
label: trans("style.backgroundColor"),
|
|
332
|
+
backgroundColor: "backgroundColor",
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
name: "shadowColor",
|
|
336
|
+
label: trans("style.shadowColor"),
|
|
337
|
+
shadowColor: "shadowColor",
|
|
338
|
+
},
|
|
339
|
+
{ name: "textSize", label: trans("style.fontSize"), fontSize: "fontSize" },
|
|
340
|
+
{
|
|
341
|
+
name: "borderColor",
|
|
342
|
+
label: trans("style.borderColor"),
|
|
343
|
+
borderColor: "borderColor",
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
name: "radius",
|
|
347
|
+
label: trans("style.borderStyle"),
|
|
348
|
+
borderStyle: "borderStyle",
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
name: "radius",
|
|
352
|
+
label: trans("style.borderRadius"),
|
|
353
|
+
borderRadius: "borderRadius",
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: "borderWidth",
|
|
357
|
+
label: trans("style.borderWidth"),
|
|
358
|
+
borderWidth: "borderWidth",
|
|
359
|
+
},
|
|
360
|
+
] as const;
|
|
361
|
+
|
|
362
|
+
export const TotalChartConfig = (function () {
|
|
363
|
+
return new MultiCompBuilder(
|
|
364
|
+
{
|
|
365
|
+
data: withDefault(BoolControl, true),
|
|
366
|
+
dataStyle: styleControl(EchartDefaultChartStyle, "dataStyle"),
|
|
367
|
+
dataType: dropdownControl(DataTypeOptions, "number"),
|
|
368
|
+
decreaseColor: ColorControl,
|
|
369
|
+
decreaseIcon: IconControl,
|
|
370
|
+
icon: IconControl,
|
|
371
|
+
iconStyle: styleControl(CompStyles, "iconStyle"),
|
|
372
|
+
increaseColor: ColorControl,
|
|
373
|
+
increaseIcon: IconControl,
|
|
374
|
+
precision: withDefault(NumberControl, 0),
|
|
375
|
+
precisionSub: withDefault(NumberControl, 1),
|
|
376
|
+
precisionTrend: withDefault(NumberControl, 2),
|
|
377
|
+
showIcon: withDefault(BoolControl, true),
|
|
378
|
+
showSubData: withDefault(BoolControl, true),
|
|
379
|
+
showTitle: withDefault(BoolControl, true),
|
|
380
|
+
showTrendIndicator: withDefault(BoolControl, true),
|
|
381
|
+
showTrendLine: withDefault(BoolControl, true),
|
|
382
|
+
subDecreaseColor: ColorControl,
|
|
383
|
+
subDecreaseIcon: IconControl,
|
|
384
|
+
subIncreaseColor: ColorControl,
|
|
385
|
+
subIncreaseIcon: IconControl,
|
|
386
|
+
subStyle: styleControl(CompStyles, "subStyle"),
|
|
387
|
+
title: StringControl,
|
|
388
|
+
titleStyle: styleControl(CompStyles, "subStyle"),
|
|
389
|
+
trendStyle: styleControl(CompStyles, "trendStyle"),
|
|
390
|
+
unit: dropdownControl(AllUnitOptions, ""),
|
|
391
|
+
showLabel: BoolControl,
|
|
392
|
+
showEndLabel: BoolControl,
|
|
393
|
+
stacked: BoolControl,
|
|
394
|
+
area: BoolControl,
|
|
395
|
+
smooth: BoolControl,
|
|
396
|
+
polar: BoolControl,
|
|
397
|
+
itemColor: ItemColorComp,
|
|
398
|
+
symbol: dropdownControl(SymbolOptions, "emptyCircle"),
|
|
399
|
+
symbolSize: withDefault(NumberControl, 4),
|
|
400
|
+
radiusAxisMax: NumberControl,
|
|
401
|
+
polarRadiusStart: withDefault(StringControl, "30"),
|
|
402
|
+
polarRadiusEnd: withDefault(StringControl, "80%"),
|
|
403
|
+
polarStartAngle: withDefault(NumberControl, 90),
|
|
404
|
+
polarEndAngle: withDefault(NumberControl, -180),
|
|
405
|
+
polarIsTangent: withDefault(BoolControl, false),
|
|
406
|
+
labelData: jsonControl(toArray, []),
|
|
407
|
+
borderColor: ColorControl,
|
|
408
|
+
borderWidth: NumberControl,
|
|
409
|
+
borderType: dropdownControl(BorderTypeOptions, "solid"),
|
|
410
|
+
showTrendline: withDefault(BoolControl, false),
|
|
411
|
+
trendlineControl: TrendlineControl,
|
|
412
|
+
},
|
|
413
|
+
(props) => {
|
|
414
|
+
const config: LineSeriesOption & {
|
|
415
|
+
polarData: any;
|
|
416
|
+
showTrendline: boolean;
|
|
417
|
+
trendlines: any;
|
|
418
|
+
} = {
|
|
419
|
+
label: {
|
|
420
|
+
show: props.showLabel,
|
|
421
|
+
},
|
|
422
|
+
symbol: props.symbol,
|
|
423
|
+
symbolSize: props.symbolSize,
|
|
424
|
+
showTrendline: props.showTrendline,
|
|
425
|
+
trendlines: props.trendlineControl,
|
|
426
|
+
itemStyle: {
|
|
427
|
+
color: (params) => {
|
|
428
|
+
const color = (props.itemColor as any)({
|
|
429
|
+
seriesName: params.seriesName,
|
|
430
|
+
value: params.data,
|
|
431
|
+
});
|
|
432
|
+
if (color === "true") {
|
|
433
|
+
return "red";
|
|
434
|
+
} else if (color === "false" || !color) {
|
|
435
|
+
return params.color;
|
|
436
|
+
}
|
|
437
|
+
return color;
|
|
438
|
+
},
|
|
439
|
+
borderColor: props.borderColor,
|
|
440
|
+
borderWidth: props.borderWidth,
|
|
441
|
+
borderType: props.borderType,
|
|
442
|
+
},
|
|
443
|
+
polarData: {
|
|
444
|
+
polar: props.polar,
|
|
445
|
+
radiusAxisMax: props.radiusAxisMax,
|
|
446
|
+
polarRadiusStart: props.polarRadiusStart,
|
|
447
|
+
polarRadiusEnd: props.polarRadiusEnd,
|
|
448
|
+
polarStartAngle: props.polarStartAngle,
|
|
449
|
+
polarEndAngle: props.polarEndAngle,
|
|
450
|
+
labelData: props.labelData,
|
|
451
|
+
polarIsTangent: props.polarIsTangent,
|
|
452
|
+
},
|
|
453
|
+
};
|
|
454
|
+
if (props.stacked) {
|
|
455
|
+
config.stack = "stackValue";
|
|
456
|
+
}
|
|
457
|
+
if (props.area) {
|
|
458
|
+
config.areaStyle = {};
|
|
459
|
+
}
|
|
460
|
+
if (props.smooth) {
|
|
461
|
+
config.smooth = true;
|
|
462
|
+
}
|
|
463
|
+
if (props.showEndLabel) {
|
|
464
|
+
config.endLabel = {
|
|
465
|
+
show: true,
|
|
466
|
+
formatter: "{a}",
|
|
467
|
+
distance: 20,
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
if (props.polar) {
|
|
471
|
+
config.coordinateSystem = "polar";
|
|
472
|
+
}
|
|
473
|
+
return {
|
|
474
|
+
type: "total",
|
|
475
|
+
dataStyle: props.dataStyle,
|
|
476
|
+
dataType: props.dataType,
|
|
477
|
+
decreaseColor: props.decreaseColor,
|
|
478
|
+
decreaseIcon: props.decreaseIcon,
|
|
479
|
+
icon: props.icon,
|
|
480
|
+
iconStyle: props.iconStyle,
|
|
481
|
+
increaseColor: props.increaseColor,
|
|
482
|
+
increaseIcon: props.increaseIcon,
|
|
483
|
+
precision: props.precision,
|
|
484
|
+
precisionSub: props.precisionSub,
|
|
485
|
+
precisionTrend: props.precisionTrend,
|
|
486
|
+
showIcon: props.showIcon,
|
|
487
|
+
showSubData: props.showSubData,
|
|
488
|
+
showTitle: props.showTitle,
|
|
489
|
+
showTrendIndicator: props.showTrendIndicator,
|
|
490
|
+
showTrendLine: props.showTrendLine,
|
|
491
|
+
subDecreaseColor: props.subDecreaseColor,
|
|
492
|
+
subDecreaseIcon: props.subDecreaseIcon,
|
|
493
|
+
subIncreaseColor: props.subIncreaseColor,
|
|
494
|
+
subIncreaseIcon: props.subIncreaseIcon,
|
|
495
|
+
subStyle: props.subStyle,
|
|
496
|
+
title: props.title,
|
|
497
|
+
titleStyle: props.titleStyle,
|
|
498
|
+
trendStyle: props.trendStyle,
|
|
499
|
+
unit: props.unit,
|
|
500
|
+
...config,
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
)
|
|
504
|
+
.setPropertyViewFn((children) => (
|
|
505
|
+
<>
|
|
506
|
+
{children.dataType.propertyView({
|
|
507
|
+
label: trans("totalChart.dataType"),
|
|
508
|
+
})}
|
|
509
|
+
{children.unit.propertyView({
|
|
510
|
+
label: trans("totalChart.unit"),
|
|
511
|
+
placeholder: "%",
|
|
512
|
+
})}
|
|
513
|
+
{children.precision.propertyView({
|
|
514
|
+
label: trans("totalChart.precision"),
|
|
515
|
+
})}
|
|
516
|
+
{children.dataStyle?.getPropertyView()}
|
|
517
|
+
<Flex vertical gap={5}>
|
|
518
|
+
<div className="sub-title">{trans("totalChart.title")}</div>
|
|
519
|
+
{children.showTitle.propertyView({
|
|
520
|
+
label: trans("totalChart.showTitle"),
|
|
521
|
+
})}
|
|
522
|
+
{children.showTitle.getView() && (
|
|
523
|
+
<>
|
|
524
|
+
{children.title?.propertyView({
|
|
525
|
+
label: trans("totalChart.title"),
|
|
526
|
+
})}
|
|
527
|
+
{children.titleStyle?.getPropertyView()}
|
|
528
|
+
</>
|
|
529
|
+
)}
|
|
530
|
+
</Flex>
|
|
531
|
+
<Flex gap={5} vertical>
|
|
532
|
+
<div className="sub-title">{trans("totalChart.icon")}</div>
|
|
533
|
+
{children.showIcon.propertyView({
|
|
534
|
+
label: trans("totalChart.showIcon"),
|
|
535
|
+
})}
|
|
536
|
+
{children.showIcon.getView() && (
|
|
537
|
+
<>
|
|
538
|
+
{children.icon.propertyView({
|
|
539
|
+
label: "Icon",
|
|
540
|
+
})}
|
|
541
|
+
{children.iconStyle?.getPropertyView()}
|
|
542
|
+
</>
|
|
543
|
+
)}
|
|
544
|
+
</Flex>
|
|
545
|
+
<Flex gap={5} vertical>
|
|
546
|
+
<div className="sub-title">{trans("totalChart.trendIndicator")}</div>
|
|
547
|
+
{children.showTrendIndicator.propertyView({
|
|
548
|
+
label: trans("totalChart.showTrendIndicator"),
|
|
549
|
+
})}
|
|
550
|
+
{children.showTrendIndicator.getView() && (
|
|
551
|
+
<>
|
|
552
|
+
{children.increaseColor.propertyView({
|
|
553
|
+
label: trans("totalChart.increaseColor"),
|
|
554
|
+
})}
|
|
555
|
+
{children.increaseIcon.propertyView({
|
|
556
|
+
label: trans("totalChart.increaseIcon"),
|
|
557
|
+
})}
|
|
558
|
+
{children.decreaseColor.propertyView({
|
|
559
|
+
label: trans("totalChart.decreaseColor"),
|
|
560
|
+
})}
|
|
561
|
+
{children.decreaseIcon.propertyView({
|
|
562
|
+
label: trans("totalChart.decreaseIcon"),
|
|
563
|
+
})}
|
|
564
|
+
{children.precisionTrend.propertyView({
|
|
565
|
+
label: trans("totalChart.precision"),
|
|
566
|
+
})}
|
|
567
|
+
</>
|
|
568
|
+
)}
|
|
569
|
+
</Flex>
|
|
570
|
+
<Flex vertical gap={5}>
|
|
571
|
+
<div className="sub-title">{trans("totalChart.subData")}</div>
|
|
572
|
+
{children.showSubData.propertyView({
|
|
573
|
+
label: trans("totalChart.showSubData"),
|
|
574
|
+
})}
|
|
575
|
+
{children.showSubData.getView() && (
|
|
576
|
+
<>
|
|
577
|
+
<>
|
|
578
|
+
{children.subIncreaseColor.propertyView({
|
|
579
|
+
label: trans("totalChart.increaseColor"),
|
|
580
|
+
})}
|
|
581
|
+
{children.subIncreaseIcon.propertyView({
|
|
582
|
+
label: trans("totalChart.increaseIcon"),
|
|
583
|
+
})}
|
|
584
|
+
{children.subDecreaseColor.propertyView({
|
|
585
|
+
label: trans("totalChart.decreaseColor"),
|
|
586
|
+
})}
|
|
587
|
+
{children.subDecreaseIcon.propertyView({
|
|
588
|
+
label: trans("totalChart.decreaseIcon"),
|
|
589
|
+
})}
|
|
590
|
+
{children.precisionSub.propertyView({
|
|
591
|
+
label: trans("totalChart.precision"),
|
|
592
|
+
})}
|
|
593
|
+
</>
|
|
594
|
+
</>
|
|
595
|
+
)}
|
|
596
|
+
</Flex>
|
|
597
|
+
<Flex gap={5} vertical>
|
|
598
|
+
<div className="sub-title">{trans("chart.trendLine")}</div>
|
|
599
|
+
{children.showTrendLine.propertyView({
|
|
600
|
+
label: trans("chart.trendLine"),
|
|
601
|
+
})}
|
|
602
|
+
|
|
603
|
+
{children.stacked.propertyView({
|
|
604
|
+
label: trans("lineChart.stacked"),
|
|
605
|
+
})}
|
|
606
|
+
{children.area.propertyView({
|
|
607
|
+
label: trans("lineChart.area"),
|
|
608
|
+
})}
|
|
609
|
+
{children.polar.propertyView({
|
|
610
|
+
label: trans("lineChart.polar"),
|
|
611
|
+
})}
|
|
612
|
+
{children.polar.getView() &&
|
|
613
|
+
children.polarIsTangent.propertyView({
|
|
614
|
+
label: trans("barChart.polarIsTangent"),
|
|
615
|
+
})}
|
|
616
|
+
{children.polar.getView() &&
|
|
617
|
+
children.polarStartAngle.propertyView({
|
|
618
|
+
label: trans("barChart.polarStartAngle"),
|
|
619
|
+
})}
|
|
620
|
+
{children.polar.getView() &&
|
|
621
|
+
children.polarEndAngle.propertyView({
|
|
622
|
+
label: trans("barChart.polarEndAngle"),
|
|
623
|
+
})}
|
|
624
|
+
{children.polar.getView() &&
|
|
625
|
+
children.radiusAxisMax.propertyView({
|
|
626
|
+
label: trans("barChart.radiusAxisMax"),
|
|
627
|
+
})}
|
|
628
|
+
{children.polar.getView() &&
|
|
629
|
+
children.polarRadiusStart.propertyView({
|
|
630
|
+
label: trans("barChart.polarRadiusStart"),
|
|
631
|
+
})}
|
|
632
|
+
{children.polar.getView() &&
|
|
633
|
+
children.polarRadiusEnd.propertyView({
|
|
634
|
+
label: trans("barChart.polarRadiusEnd"),
|
|
635
|
+
})}
|
|
636
|
+
{children.polar.getView() &&
|
|
637
|
+
children.labelData.propertyView({
|
|
638
|
+
label: trans("barChart.polarLabelData"),
|
|
639
|
+
})}
|
|
640
|
+
{showLabelPropertyView(children)}
|
|
641
|
+
{children.showEndLabel.propertyView({
|
|
642
|
+
label: trans("lineChart.showEndLabel"),
|
|
643
|
+
})}
|
|
644
|
+
{children.smooth.propertyView({ label: trans("chart.smooth") })}
|
|
645
|
+
{children.symbol.propertyView({
|
|
646
|
+
label: trans("lineChart.symbol"),
|
|
647
|
+
})}
|
|
648
|
+
{children.symbolSize.propertyView({
|
|
649
|
+
label: trans("lineChart.symbolSize"),
|
|
650
|
+
})}
|
|
651
|
+
{children.itemColor.getPropertyView()}
|
|
652
|
+
{children.borderColor.propertyView({
|
|
653
|
+
label: trans("lineChart.borderColor"),
|
|
654
|
+
})}
|
|
655
|
+
{children.borderWidth.propertyView({
|
|
656
|
+
label: trans("lineChart.borderWidth"),
|
|
657
|
+
})}
|
|
658
|
+
{children.borderType.propertyView({
|
|
659
|
+
label: trans("lineChart.borderType"),
|
|
660
|
+
})}
|
|
661
|
+
{children.showTrendline.propertyView({
|
|
662
|
+
label: trans("lineChart.showTrendline"),
|
|
663
|
+
})}
|
|
664
|
+
{children.showTrendline.getView() &&
|
|
665
|
+
children.trendlineControl.getPropertyView()}
|
|
666
|
+
</Flex>
|
|
667
|
+
</>
|
|
668
|
+
))
|
|
669
|
+
.build();
|
|
670
|
+
})();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { trans } from "@/i18n/comps";
|
|
2
|
+
import { TreeSeriesOption } from "echarts";
|
|
3
|
+
import {
|
|
4
|
+
BoolControl,
|
|
5
|
+
MultiCompBuilder,
|
|
6
|
+
showLabelPropertyView,
|
|
7
|
+
} from "lowcoder-sdk";
|
|
8
|
+
|
|
9
|
+
export const TreeChartConfig = (function () {
|
|
10
|
+
return new MultiCompBuilder(
|
|
11
|
+
{
|
|
12
|
+
showLabel: BoolControl,
|
|
13
|
+
},
|
|
14
|
+
(_): TreeSeriesOption => {
|
|
15
|
+
const config: TreeSeriesOption = {
|
|
16
|
+
type: "tree",
|
|
17
|
+
};
|
|
18
|
+
return config;
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
.setPropertyViewFn((children) => (
|
|
22
|
+
<>
|
|
23
|
+
{showLabelPropertyView(children)}
|
|
24
|
+
{children.type.propertyView({
|
|
25
|
+
label: trans("treeChart.treeType"),
|
|
26
|
+
radioButton: true,
|
|
27
|
+
})}
|
|
28
|
+
</>
|
|
29
|
+
))
|
|
30
|
+
.build();
|
|
31
|
+
})();
|