Skip to content

Commit 048b326

Browse files
committed
heatmap
1 parent 6aeba33 commit 048b326

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

client/packages/lowcoder-comps/src/comps/basicChartComp/chartConfigs/scatterChartConfig.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
MultiCompBuilder,
33
dropdownControl,
44
BoolControl,
5+
StringControl,
56
NumberControl,
67
ColorControl,
78
withDefault,
@@ -52,6 +53,8 @@ export const ScatterChartConfig = (function () {
5253
visualMapColorMin: ColorControl,
5354
visualMapColorMax: ColorControl,
5455
polar: BoolControl,
56+
heatmap: BoolControl,
57+
heatmapMonth: withDefault(StringControl, "2021-09"),
5558
},
5659
(props): ScatterSeriesOption => {
5760
return {
@@ -88,6 +91,8 @@ export const ScatterChartConfig = (function () {
8891
visualMapColorMax: props.visualMapColorMax,
8992
},
9093
polar: props.polar,
94+
heatmap: props.heatmap,
95+
heatmapMonth: props.heatmapMonth,
9196
};
9297
}
9398
)
@@ -124,6 +129,12 @@ export const ScatterChartConfig = (function () {
124129
{children.visualMap.getView() && children.visualMapColorMax.propertyView({
125130
label: trans("scatterChart.visualMapColorMax"),
126131
})}
132+
{children.visualMap.getView() && children.heatmap.propertyView({
133+
label: trans("scatterChart.heatmap"),
134+
})}
135+
{children.visualMap.getView() && children.heatmapMonth.propertyView({
136+
label: trans("scatterChart.heatmapMonth"),
137+
})}
127138
{children.polar.propertyView({
128139
label: trans("scatterChart.polar"),
129140
})}

client/packages/lowcoder-comps/src/comps/scatterChartComp/scatterChartUtils.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ export function getSeriesConfig(props: EchartsConfigProps) {
122122
if(props.chartConfig.polar) {
123123
config.coordinateSystem = 'polar';
124124
}
125+
if(props.chartConfig.heatmap) {
126+
config.coordinateSystem = 'calendar';
127+
config.type = 'heatmap';
128+
}
125129
if(s.effect) config.type = "effectScatter";
126130
if(s.symbolSize) config.symbolSize = s.symbolSize;
127131
if(s.dynamicSize) config.symbolSize = function(dataItem) {
@@ -262,6 +266,27 @@ export function getEchartsConfig(
262266
delete config.yAxis;
263267
}
264268

269+
if(props.chartConfig.heatmap) {
270+
config.calendar = {
271+
orient: 'vertical',
272+
yearLabel: {
273+
margin: 40
274+
},
275+
monthLabel: {
276+
nameMap: 'cn',
277+
margin: 20
278+
},
279+
dayLabel: {
280+
firstDay: 1,
281+
nameMap: 'cn'
282+
},
283+
cellSize: 40,
284+
range: props.chartConfig.heatmapMonth,
285+
}
286+
delete config.xAxis;
287+
delete config.yAxis;
288+
}
289+
265290
console.log("Echarts transformedData and config", transformedData, config);
266291
return config;
267292
}

client/packages/lowcoder-comps/src/i18n/comps/locales/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ export const en = {
379379
labelLineLength2: "Label Line Length2",
380380
},
381381
scatterChart: {
382+
heatmap: "Heat Map",
383+
heatmapMonth: "Heat Map Month",
382384
polar: "Polar Chart",
383385
visualMap: "Visual Map",
384386
visualMapMin: "Visual Map Min",

0 commit comments

Comments
 (0)