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,246 @@
|
|
|
1
|
+
import TrendlineControl from "@/controls/TrendlineControl";
|
|
2
|
+
import { trans } from "@/i18n/comps";
|
|
3
|
+
import { LineSeriesOption } from "echarts";
|
|
4
|
+
import {
|
|
5
|
+
BoolControl,
|
|
6
|
+
ColorControl,
|
|
7
|
+
ColorOrBoolCodeControl,
|
|
8
|
+
dropdownControl,
|
|
9
|
+
jsonControl,
|
|
10
|
+
MultiCompBuilder,
|
|
11
|
+
NumberControl,
|
|
12
|
+
showLabelPropertyView,
|
|
13
|
+
StringControl,
|
|
14
|
+
toArray,
|
|
15
|
+
withContext,
|
|
16
|
+
withDefault,
|
|
17
|
+
} from "lowcoder-sdk";
|
|
18
|
+
|
|
19
|
+
export const BorderTypeOptions = [
|
|
20
|
+
{
|
|
21
|
+
label: trans("chart.solid"),
|
|
22
|
+
value: "solid",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: trans("chart.dashed"),
|
|
26
|
+
value: "dashed",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: trans("chart.dotted"),
|
|
30
|
+
value: "dotted",
|
|
31
|
+
},
|
|
32
|
+
] as const;
|
|
33
|
+
|
|
34
|
+
export const SymbolOptions = [
|
|
35
|
+
{
|
|
36
|
+
label: trans("chart.rect"),
|
|
37
|
+
value: "rect",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: trans("chart.circle"),
|
|
41
|
+
value: "circle",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: trans("chart.roundRect"),
|
|
45
|
+
value: "roundRect",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: trans("chart.triangle"),
|
|
49
|
+
value: "triangle",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: trans("chart.diamond"),
|
|
53
|
+
value: "diamond",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: trans("chart.pin"),
|
|
57
|
+
value: "pin",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: trans("chart.arrow"),
|
|
61
|
+
value: "arrow",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: trans("chart.none"),
|
|
65
|
+
value: "none",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: trans("chart.emptyCircle"),
|
|
69
|
+
value: "emptyCircle",
|
|
70
|
+
},
|
|
71
|
+
] as const;
|
|
72
|
+
|
|
73
|
+
export const ItemColorComp = withContext(
|
|
74
|
+
new MultiCompBuilder(
|
|
75
|
+
{ value: ColorOrBoolCodeControl },
|
|
76
|
+
(props) => props.value
|
|
77
|
+
)
|
|
78
|
+
// .setPropertyViewFn((children) =>
|
|
79
|
+
// children.value.propertyView({
|
|
80
|
+
// label: trans("chart.pointColorLabel"),
|
|
81
|
+
// placeholder: "{{value < 25000}}",
|
|
82
|
+
// tooltip: trans("chart.pointColorTooltip"),
|
|
83
|
+
// })
|
|
84
|
+
// )
|
|
85
|
+
.build(),
|
|
86
|
+
["seriesName", "value"] as const
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
export const LineChartConfigv2 = (function () {
|
|
90
|
+
return new MultiCompBuilder(
|
|
91
|
+
{
|
|
92
|
+
showLabel: BoolControl,
|
|
93
|
+
showEndLabel: BoolControl,
|
|
94
|
+
// stacked: BoolControl,
|
|
95
|
+
// area: BoolControl,
|
|
96
|
+
// smooth: BoolControl,
|
|
97
|
+
// polar: BoolControl,
|
|
98
|
+
itemColor: ItemColorComp,
|
|
99
|
+
symbol: dropdownControl(SymbolOptions, "emptyCircle"),
|
|
100
|
+
symbolSize: withDefault(NumberControl, 4),
|
|
101
|
+
radiusAxisMax: NumberControl,
|
|
102
|
+
polarRadiusStart: withDefault(StringControl, "30"),
|
|
103
|
+
polarRadiusEnd: withDefault(StringControl, "80%"),
|
|
104
|
+
polarStartAngle: withDefault(NumberControl, 90),
|
|
105
|
+
polarEndAngle: withDefault(NumberControl, -180),
|
|
106
|
+
polarIsTangent: withDefault(BoolControl, false),
|
|
107
|
+
labelData: jsonControl(toArray, []),
|
|
108
|
+
borderColor: ColorControl,
|
|
109
|
+
borderWidth: NumberControl,
|
|
110
|
+
borderType: dropdownControl(BorderTypeOptions, "solid"),
|
|
111
|
+
showTrendline: withDefault(BoolControl, false),
|
|
112
|
+
trendlineControl: TrendlineControl,
|
|
113
|
+
},
|
|
114
|
+
(props): LineSeriesOption => {
|
|
115
|
+
const config: LineSeriesOption & {
|
|
116
|
+
polarData: any;
|
|
117
|
+
showTrendline: boolean;
|
|
118
|
+
trendlines: any;
|
|
119
|
+
} = {
|
|
120
|
+
type: "line",
|
|
121
|
+
label: {
|
|
122
|
+
show: props.showLabel,
|
|
123
|
+
},
|
|
124
|
+
symbol: props.symbol,
|
|
125
|
+
symbolSize: props.symbolSize,
|
|
126
|
+
showTrendline: props.showTrendline,
|
|
127
|
+
trendlines: props.trendlineControl,
|
|
128
|
+
itemStyle: {
|
|
129
|
+
color: (params) => {
|
|
130
|
+
const color = (props.itemColor as any)({
|
|
131
|
+
seriesName: params.seriesName,
|
|
132
|
+
value: params.data,
|
|
133
|
+
});
|
|
134
|
+
if (color === "true") {
|
|
135
|
+
return "red";
|
|
136
|
+
} else if (color === "false" || !color) {
|
|
137
|
+
return params.color;
|
|
138
|
+
}
|
|
139
|
+
return color;
|
|
140
|
+
},
|
|
141
|
+
borderColor: props.borderColor,
|
|
142
|
+
borderWidth: props.borderWidth,
|
|
143
|
+
borderType: props.borderType,
|
|
144
|
+
},
|
|
145
|
+
polarData: {
|
|
146
|
+
polar: props.polar,
|
|
147
|
+
radiusAxisMax: props.radiusAxisMax,
|
|
148
|
+
polarRadiusStart: props.polarRadiusStart,
|
|
149
|
+
polarRadiusEnd: props.polarRadiusEnd,
|
|
150
|
+
polarStartAngle: props.polarStartAngle,
|
|
151
|
+
polarEndAngle: props.polarEndAngle,
|
|
152
|
+
labelData: props.labelData,
|
|
153
|
+
polarIsTangent: props.polarIsTangent,
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
// if (props.stacked) {
|
|
157
|
+
// config.stack = "stackValue";
|
|
158
|
+
// }
|
|
159
|
+
// if (props.area) {
|
|
160
|
+
// config.areaStyle = {};
|
|
161
|
+
// }
|
|
162
|
+
// if (props.smooth) {
|
|
163
|
+
// config.smooth = true;
|
|
164
|
+
// }
|
|
165
|
+
if (props.showEndLabel) {
|
|
166
|
+
config.endLabel = {
|
|
167
|
+
show: true,
|
|
168
|
+
formatter: "{a}",
|
|
169
|
+
distance: 20,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
if (props.polar) {
|
|
173
|
+
config.coordinateSystem = "polar";
|
|
174
|
+
}
|
|
175
|
+
return config;
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
.setPropertyViewFn((children) => (
|
|
179
|
+
<>
|
|
180
|
+
{/* {children.stacked.propertyView({
|
|
181
|
+
label: trans("lineChart.stacked"),
|
|
182
|
+
})}
|
|
183
|
+
{children.area.propertyView({
|
|
184
|
+
label: trans("lineChart.area"),
|
|
185
|
+
})}
|
|
186
|
+
{children.polar.propertyView({
|
|
187
|
+
label: trans("lineChart.polar"),
|
|
188
|
+
})}
|
|
189
|
+
{children.polar.getView() &&
|
|
190
|
+
children.polarIsTangent.propertyView({
|
|
191
|
+
label: trans("barChart.polarIsTangent"),
|
|
192
|
+
})}
|
|
193
|
+
{children.polar.getView() &&
|
|
194
|
+
children.polarStartAngle.propertyView({
|
|
195
|
+
label: trans("barChart.polarStartAngle"),
|
|
196
|
+
})}
|
|
197
|
+
{children.polar.getView() &&
|
|
198
|
+
children.polarEndAngle.propertyView({
|
|
199
|
+
label: trans("barChart.polarEndAngle"),
|
|
200
|
+
})}
|
|
201
|
+
{children.polar.getView() &&
|
|
202
|
+
children.radiusAxisMax.propertyView({
|
|
203
|
+
label: trans("barChart.radiusAxisMax"),
|
|
204
|
+
})}
|
|
205
|
+
{children.polar.getView() &&
|
|
206
|
+
children.polarRadiusStart.propertyView({
|
|
207
|
+
label: trans("barChart.polarRadiusStart"),
|
|
208
|
+
})}
|
|
209
|
+
{children.polar.getView() &&
|
|
210
|
+
children.polarRadiusEnd.propertyView({
|
|
211
|
+
label: trans("barChart.polarRadiusEnd"),
|
|
212
|
+
})}
|
|
213
|
+
{children.polar.getView() &&
|
|
214
|
+
children.labelData.propertyView({
|
|
215
|
+
label: trans("barChart.polarLabelData"),
|
|
216
|
+
})} */}
|
|
217
|
+
{showLabelPropertyView(children)}
|
|
218
|
+
{children.showEndLabel.propertyView({
|
|
219
|
+
label: trans("lineChart.showEndLabel"),
|
|
220
|
+
})}
|
|
221
|
+
{children.smooth.propertyView({ label: trans("chart.smooth") })}
|
|
222
|
+
{children.symbol.propertyView({
|
|
223
|
+
label: trans("lineChart.symbol"),
|
|
224
|
+
})}
|
|
225
|
+
{children.symbolSize.propertyView({
|
|
226
|
+
label: trans("lineChart.symbolSize"),
|
|
227
|
+
})}
|
|
228
|
+
{/* {children.itemColor.getPropertyView()} */}
|
|
229
|
+
{children.borderColor.propertyView({
|
|
230
|
+
label: trans("lineChart.borderColor"),
|
|
231
|
+
})}
|
|
232
|
+
{children.borderWidth.propertyView({
|
|
233
|
+
label: trans("lineChart.borderWidth"),
|
|
234
|
+
})}
|
|
235
|
+
{children.borderType.propertyView({
|
|
236
|
+
label: trans("lineChart.borderType"),
|
|
237
|
+
})}
|
|
238
|
+
{children.showTrendline.propertyView({
|
|
239
|
+
label: trans("lineChart.showTrendline"),
|
|
240
|
+
})}
|
|
241
|
+
{children.showTrendline.getView() &&
|
|
242
|
+
children.trendlineControl.getPropertyView()}
|
|
243
|
+
</>
|
|
244
|
+
))
|
|
245
|
+
.build();
|
|
246
|
+
})();
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ColorScaleControls } from "@/controls/ColorScaleControl";
|
|
2
|
+
import { trans } from "@/i18n/comps";
|
|
3
|
+
import { MapSeriesOption } from "echarts";
|
|
4
|
+
import {
|
|
5
|
+
BoolControl,
|
|
6
|
+
ColorOrBoolCodeControl,
|
|
7
|
+
dropdownControl,
|
|
8
|
+
MultiCompBuilder,
|
|
9
|
+
StringControl,
|
|
10
|
+
withContext,
|
|
11
|
+
} from "lowcoder-sdk";
|
|
12
|
+
export const MapTypeOptions = [
|
|
13
|
+
{
|
|
14
|
+
label: "World",
|
|
15
|
+
value: "world",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: "Viet Nam",
|
|
19
|
+
value: "vietnam",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: "Custom",
|
|
23
|
+
value: "custom",
|
|
24
|
+
},
|
|
25
|
+
] as const;
|
|
26
|
+
export const RegionMapTypeOptions = [
|
|
27
|
+
{
|
|
28
|
+
label: "Choropleth",
|
|
29
|
+
value: "choropleth",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: "Bubble Map",
|
|
33
|
+
value: "bubble-map",
|
|
34
|
+
},
|
|
35
|
+
] as const;
|
|
36
|
+
|
|
37
|
+
export const ItemColorComp = withContext(
|
|
38
|
+
new MultiCompBuilder(
|
|
39
|
+
{ value: ColorOrBoolCodeControl },
|
|
40
|
+
(props) => props.value
|
|
41
|
+
)
|
|
42
|
+
.setPropertyViewFn((children) =>
|
|
43
|
+
children.value.propertyView({
|
|
44
|
+
label: trans("chart.regionColorLabel"),
|
|
45
|
+
placeholder: "{{value < 50}}",
|
|
46
|
+
tooltip: trans("chart.regionColorTooltip"),
|
|
47
|
+
})
|
|
48
|
+
)
|
|
49
|
+
.build(),
|
|
50
|
+
["name", "value"] as const
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
export const MapChartConfig = (function () {
|
|
54
|
+
return new MultiCompBuilder(
|
|
55
|
+
{
|
|
56
|
+
colorScale: ColorScaleControls,
|
|
57
|
+
mapType: dropdownControl(MapTypeOptions, "vietnam"),
|
|
58
|
+
mapUrl: StringControl,
|
|
59
|
+
roam: BoolControl,
|
|
60
|
+
showLabel: BoolControl,
|
|
61
|
+
},
|
|
62
|
+
(props): MapSeriesOption => {
|
|
63
|
+
const config: MapSeriesOption = {
|
|
64
|
+
...props,
|
|
65
|
+
type: "map",
|
|
66
|
+
map: props.mapType,
|
|
67
|
+
roam: props.roam,
|
|
68
|
+
label: {
|
|
69
|
+
show: props.showLabel,
|
|
70
|
+
},
|
|
71
|
+
emphasis: {
|
|
72
|
+
itemStyle: {
|
|
73
|
+
areaColor: props.emphasisColor,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
return config;
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
.setPropertyViewFn((children) => {
|
|
82
|
+
return (
|
|
83
|
+
<>
|
|
84
|
+
{children.colorScale.getPropertyView()}
|
|
85
|
+
{children.mapType.propertyView({
|
|
86
|
+
label: trans("mapChart.mapType"),
|
|
87
|
+
})}
|
|
88
|
+
{children.mapType.getView() === "custom" &&
|
|
89
|
+
children.mapUrl.propertyView({
|
|
90
|
+
label: trans("mapChart.mapUrl"),
|
|
91
|
+
tooltip: trans("mapChart.mapUrlTooltip"),
|
|
92
|
+
placeholder: "https://example.com/map.json",
|
|
93
|
+
})}
|
|
94
|
+
|
|
95
|
+
{children.roam.propertyView({
|
|
96
|
+
label: trans("mapChart.roam"),
|
|
97
|
+
})}
|
|
98
|
+
{children.showLabel.propertyView({
|
|
99
|
+
label: trans("mapChart.showLabel"),
|
|
100
|
+
})}
|
|
101
|
+
</>
|
|
102
|
+
);
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
.build();
|
|
106
|
+
})();
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ColorScaleControls } from "@/controls/ColorScaleControl";
|
|
2
|
+
import { trans } from "@/i18n/comps";
|
|
3
|
+
import { MapSeriesOption } from "echarts";
|
|
4
|
+
import {
|
|
5
|
+
BoolControl,
|
|
6
|
+
ColorOrBoolCodeControl,
|
|
7
|
+
dropdownControl,
|
|
8
|
+
MultiCompBuilder,
|
|
9
|
+
StringControl,
|
|
10
|
+
withContext,
|
|
11
|
+
} from "lowcoder-sdk";
|
|
12
|
+
export const MapTypeOptions = [
|
|
13
|
+
// {
|
|
14
|
+
// label: "World",
|
|
15
|
+
// value: "world",
|
|
16
|
+
// },
|
|
17
|
+
{
|
|
18
|
+
label: "Viet Nam",
|
|
19
|
+
value: "vietnam",
|
|
20
|
+
},
|
|
21
|
+
// {
|
|
22
|
+
// label: "Custom",
|
|
23
|
+
// value: "custom",
|
|
24
|
+
// },
|
|
25
|
+
] as const;
|
|
26
|
+
export const RegionMapTypeOptions = [
|
|
27
|
+
{
|
|
28
|
+
label: "Choropleth",
|
|
29
|
+
value: "choropleth",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: "Bubble Map",
|
|
33
|
+
value: "bubble-map",
|
|
34
|
+
},
|
|
35
|
+
] as const;
|
|
36
|
+
|
|
37
|
+
export const ItemColorComp = withContext(
|
|
38
|
+
new MultiCompBuilder(
|
|
39
|
+
{ value: ColorOrBoolCodeControl },
|
|
40
|
+
(props) => props.value
|
|
41
|
+
)
|
|
42
|
+
.setPropertyViewFn((children) =>
|
|
43
|
+
children.value.propertyView({
|
|
44
|
+
label: trans("chart.regionColorLabel"),
|
|
45
|
+
placeholder: "{{value < 50}}",
|
|
46
|
+
tooltip: trans("chart.regionColorTooltip"),
|
|
47
|
+
})
|
|
48
|
+
)
|
|
49
|
+
.build(),
|
|
50
|
+
["name", "value"] as const
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
export const MapChartConfigV2 = (function () {
|
|
54
|
+
return new MultiCompBuilder(
|
|
55
|
+
{
|
|
56
|
+
colorScale: ColorScaleControls,
|
|
57
|
+
mapType: dropdownControl(MapTypeOptions, "vietnam"),
|
|
58
|
+
mapUrl: StringControl,
|
|
59
|
+
roam: BoolControl,
|
|
60
|
+
showLabel: BoolControl,
|
|
61
|
+
},
|
|
62
|
+
(props): MapSeriesOption => {
|
|
63
|
+
const config: MapSeriesOption = {
|
|
64
|
+
...props,
|
|
65
|
+
type: "mapv2",
|
|
66
|
+
map: props.mapType,
|
|
67
|
+
roam: props.roam,
|
|
68
|
+
label: {
|
|
69
|
+
show: props.showLabel,
|
|
70
|
+
},
|
|
71
|
+
emphasis: {
|
|
72
|
+
itemStyle: {
|
|
73
|
+
areaColor: props.emphasisColor,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
return config;
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
.setPropertyViewFn((children) => {
|
|
82
|
+
return (
|
|
83
|
+
<>
|
|
84
|
+
{/* {children.colorScale.getPropertyView()} */}
|
|
85
|
+
{children.mapType.propertyView({
|
|
86
|
+
label: trans("mapChart.mapType"),
|
|
87
|
+
})}
|
|
88
|
+
{children.mapType.getView() === "custom" &&
|
|
89
|
+
children.mapUrl.propertyView({
|
|
90
|
+
label: trans("mapChart.mapUrl"),
|
|
91
|
+
tooltip: trans("mapChart.mapUrlTooltip"),
|
|
92
|
+
placeholder: "https://example.com/map.json",
|
|
93
|
+
})}
|
|
94
|
+
|
|
95
|
+
{children.roam.propertyView({
|
|
96
|
+
label: trans("mapChart.roam"),
|
|
97
|
+
})}
|
|
98
|
+
{children.showLabel.propertyView({
|
|
99
|
+
label: trans("mapChart.showLabel"),
|
|
100
|
+
})}
|
|
101
|
+
</>
|
|
102
|
+
);
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
.build();
|
|
106
|
+
})();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BarSeriesOption, LineSeriesOption } from "echarts";
|
|
2
|
+
import { MultiCompBuilder } from "lowcoder-sdk";
|
|
3
|
+
import { BarChartConfig } from "./barChartConfig";
|
|
4
|
+
import { LineChartConfig } from "./lineChartConfig";
|
|
5
|
+
|
|
6
|
+
export const MixedChartConfig = (function () {
|
|
7
|
+
return new MultiCompBuilder(
|
|
8
|
+
{
|
|
9
|
+
line: LineChartConfig,
|
|
10
|
+
bar: BarChartConfig,
|
|
11
|
+
},
|
|
12
|
+
(props): any[] => {
|
|
13
|
+
const lineConfig = props.line as LineSeriesOption;
|
|
14
|
+
const barConfig = props.bar as BarSeriesOption;
|
|
15
|
+
|
|
16
|
+
return [lineConfig, barConfig];
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
.setPropertyViewFn((children) => <></>)
|
|
20
|
+
.build();
|
|
21
|
+
})();
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { trans } from "@/i18n/comps";
|
|
2
|
+
import { PieSeriesOption } from "echarts";
|
|
3
|
+
import {
|
|
4
|
+
ColorControl,
|
|
5
|
+
ConstructorToView,
|
|
6
|
+
dropdownControl,
|
|
7
|
+
MultiCompBuilder,
|
|
8
|
+
NumberControl,
|
|
9
|
+
StringControl,
|
|
10
|
+
withDefault,
|
|
11
|
+
} from "lowcoder-sdk";
|
|
12
|
+
|
|
13
|
+
// radius percent for each pie chart when one line has [1, 2, 3] pie charts
|
|
14
|
+
const pieRadiusConfig = [65, 35, 20];
|
|
15
|
+
|
|
16
|
+
export type PieConfigViewType = ConstructorToView<typeof PieChartConfig>;
|
|
17
|
+
|
|
18
|
+
const PieTypeOptions = [
|
|
19
|
+
{
|
|
20
|
+
label: trans("chart.pie"),
|
|
21
|
+
value: "pie",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: trans("chart.rosePie"),
|
|
25
|
+
value: "rosePie",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: trans("chart.doughnutPie"),
|
|
29
|
+
value: "doughnutPie",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: trans("chart.calendarPie"),
|
|
33
|
+
value: "calendarPie",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: trans("chart.geoPie"),
|
|
37
|
+
value: "geoPie",
|
|
38
|
+
},
|
|
39
|
+
] as const;
|
|
40
|
+
|
|
41
|
+
export const PieChartConfig = (function () {
|
|
42
|
+
return new MultiCompBuilder(
|
|
43
|
+
{
|
|
44
|
+
type: dropdownControl(PieTypeOptions, "pie"),
|
|
45
|
+
cellSize: withDefault(NumberControl, 40),
|
|
46
|
+
borderColor: ColorControl,
|
|
47
|
+
borderWidth: StringControl,
|
|
48
|
+
borderRadius: StringControl,
|
|
49
|
+
},
|
|
50
|
+
(props): PieSeriesOption => {
|
|
51
|
+
const config: PieSeriesOption = {
|
|
52
|
+
type: "pie",
|
|
53
|
+
label: {
|
|
54
|
+
show: true,
|
|
55
|
+
formatter: "{d}%",
|
|
56
|
+
},
|
|
57
|
+
itemStyle: {
|
|
58
|
+
borderColor: props.borderColor,
|
|
59
|
+
borderWidth: props.borderWidth,
|
|
60
|
+
borderRadius: props.borderRadius,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
if (props.type === "rosePie") {
|
|
64
|
+
config.roseType = "area";
|
|
65
|
+
}
|
|
66
|
+
if (props.type === "doughnutPie") {
|
|
67
|
+
config.radius = ["40%", "60%"];
|
|
68
|
+
}
|
|
69
|
+
if (props.type === "calendarPie") {
|
|
70
|
+
config.coordinateSystem = "calendar";
|
|
71
|
+
config.cellSize = [props.cellSize, props.cellSize];
|
|
72
|
+
config.label = {
|
|
73
|
+
...config.label,
|
|
74
|
+
position: "inside",
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return config;
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
// luongld2: lỗi khi khi switch qua calendarchart nên comment lại thử
|
|
82
|
+
.setPropertyViewFn((children) => (
|
|
83
|
+
<>
|
|
84
|
+
{children.type.propertyView({
|
|
85
|
+
label: trans("chart.pieType"),
|
|
86
|
+
})}
|
|
87
|
+
{children.borderColor.propertyView({
|
|
88
|
+
label: trans("style.borderColor"),
|
|
89
|
+
})}
|
|
90
|
+
{children.borderWidth.propertyView({
|
|
91
|
+
label: trans("style.borderWidth"),
|
|
92
|
+
})}
|
|
93
|
+
{children.borderRadius.propertyView({
|
|
94
|
+
label: trans("style.borderRadius"),
|
|
95
|
+
})}
|
|
96
|
+
</>
|
|
97
|
+
))
|
|
98
|
+
// .setPropertyViewFn((children) => (
|
|
99
|
+
// <>
|
|
100
|
+
// {children.type.propertyView({
|
|
101
|
+
// label: trans("chart.pieType"),
|
|
102
|
+
// })}
|
|
103
|
+
// {children.type.getView() === "calendarPie" &&
|
|
104
|
+
// children.cellSize.propertyView({
|
|
105
|
+
// label: trans("lineChart.cellSize"),
|
|
106
|
+
// })}
|
|
107
|
+
// {children.type.getView() === "calendarPie" &&
|
|
108
|
+
// children.range.propertyView({
|
|
109
|
+
// label: trans("lineChart.range"),
|
|
110
|
+
// })}
|
|
111
|
+
// {children.type.getView() === "geoPie" &&
|
|
112
|
+
// children.mapUrl.propertyView({
|
|
113
|
+
// label: trans("pieChart.mapUrl"),
|
|
114
|
+
// })}
|
|
115
|
+
// {children.borderColor.propertyView({
|
|
116
|
+
// label: trans("style.borderColor"),
|
|
117
|
+
// })}
|
|
118
|
+
// {children.borderWidth.propertyView({
|
|
119
|
+
// label: trans("style.borderWidth"),
|
|
120
|
+
// })}
|
|
121
|
+
// {children.borderRadius.propertyView({
|
|
122
|
+
// label: trans("style.borderRadius"),
|
|
123
|
+
// })}
|
|
124
|
+
// </>
|
|
125
|
+
// ))
|
|
126
|
+
.build();
|
|
127
|
+
})();
|
|
128
|
+
|
|
129
|
+
export function getPieRadiusAndCenter(
|
|
130
|
+
seriesLength: number,
|
|
131
|
+
pieIndex: number,
|
|
132
|
+
pieConfig: PieConfigViewType
|
|
133
|
+
) {
|
|
134
|
+
const columnPieNum = Math.min(seriesLength, pieRadiusConfig.length);
|
|
135
|
+
const radiusNumber = pieRadiusConfig[columnPieNum - 1];
|
|
136
|
+
const isDoughnutPie = Array.isArray(pieConfig.radius);
|
|
137
|
+
const radius = isDoughnutPie
|
|
138
|
+
? [(radiusNumber / 1.6).toFixed(2) + "%", radiusNumber + "%"]
|
|
139
|
+
: radiusNumber + "%";
|
|
140
|
+
|
|
141
|
+
/*** calculate center coordinates ***/
|
|
142
|
+
const pieDiameter = 100 / columnPieNum;
|
|
143
|
+
const xPosition =
|
|
144
|
+
(pieDiameter * (pieIndex % columnPieNum) + pieDiameter / 2).toFixed(2) +
|
|
145
|
+
"%";
|
|
146
|
+
const rowIndex = Math.floor(pieIndex / columnPieNum) + 1;
|
|
147
|
+
const yPosition =
|
|
148
|
+
(
|
|
149
|
+
(100 / Math.floor((columnPieNum * 2 + seriesLength - 1) / columnPieNum)) *
|
|
150
|
+
rowIndex
|
|
151
|
+
).toFixed(2) + "%";
|
|
152
|
+
return {
|
|
153
|
+
radius: radius,
|
|
154
|
+
center: [xPosition, yPosition],
|
|
155
|
+
} as const;
|
|
156
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { trans } from "@/i18n/comps";
|
|
2
|
+
import { RadarSeriesOption } from "echarts";
|
|
3
|
+
import {
|
|
4
|
+
BoolControl,
|
|
5
|
+
MultiCompBuilder,
|
|
6
|
+
showLabelPropertyView,
|
|
7
|
+
} from "lowcoder-sdk";
|
|
8
|
+
|
|
9
|
+
export const RadarChartConfig = (function () {
|
|
10
|
+
return new MultiCompBuilder(
|
|
11
|
+
{
|
|
12
|
+
showLabel: BoolControl,
|
|
13
|
+
},
|
|
14
|
+
(props): RadarSeriesOption => {
|
|
15
|
+
const config: RadarSeriesOption = {
|
|
16
|
+
type: "radar",
|
|
17
|
+
};
|
|
18
|
+
return config;
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
.setPropertyViewFn((children) => (
|
|
22
|
+
<>
|
|
23
|
+
{showLabelPropertyView(children)}
|
|
24
|
+
{children.type.propertyView({
|
|
25
|
+
label: trans("radarChart.radarType"),
|
|
26
|
+
radioButton: true,
|
|
27
|
+
})}
|
|
28
|
+
</>
|
|
29
|
+
))
|
|
30
|
+
.build();
|
|
31
|
+
})();
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { trans } from "@/i18n/comps";
|
|
2
|
+
import { SankeySeriesOption } from "echarts";
|
|
3
|
+
import {
|
|
4
|
+
BoolControl,
|
|
5
|
+
MultiCompBuilder,
|
|
6
|
+
showLabelPropertyView,
|
|
7
|
+
} from "lowcoder-sdk";
|
|
8
|
+
|
|
9
|
+
export const SankeyChartConfig = (function () {
|
|
10
|
+
return new MultiCompBuilder(
|
|
11
|
+
{
|
|
12
|
+
showLabel: BoolControl,
|
|
13
|
+
},
|
|
14
|
+
(props): SankeySeriesOption => {
|
|
15
|
+
const config: SankeySeriesOption = {
|
|
16
|
+
type: "sankey",
|
|
17
|
+
label: {
|
|
18
|
+
show: props.showLabel,
|
|
19
|
+
position: "top",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
return config;
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
.setPropertyViewFn((children) => (
|
|
26
|
+
<>
|
|
27
|
+
{showLabelPropertyView(children)}
|
|
28
|
+
{children.type.propertyView({
|
|
29
|
+
label: trans("sankeyChart.sankeyType"),
|
|
30
|
+
radioButton: true,
|
|
31
|
+
})}
|
|
32
|
+
</>
|
|
33
|
+
))
|
|
34
|
+
.build();
|
|
35
|
+
})();
|