Skip to content

Commit 611eb60

Browse files
committed
punch card
1 parent 9e1f789 commit 611eb60

File tree

4 files changed

+43
-12
lines changed

4 files changed

+43
-12
lines changed

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

+10-6
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ export const ScatterChartConfig = (function () {
4040
return new MultiCompBuilder(
4141
{
4242
showLabel: BoolControl,
43+
labelIndex: withDefault(NumberControl, 2),
4344
shape: dropdownControl(ScatterShapeOptions, "circle"),
4445
singleAxis: BoolControl,
45-
divider: withDefault(NumberControl, 1000),
46+
boundaryGap: withDefault(BoolControl, true),
4647
},
4748
(props): ScatterSeriesOption => {
4849
return {
@@ -52,7 +53,7 @@ export const ScatterChartConfig = (function () {
5253
show: props.showLabel,
5354
position: 'right',
5455
formatter: function (param) {
55-
return param.data[2];
56+
return param.data[props.labelIndex];
5657
},
5758
},
5859
labelLayout: function () {
@@ -69,22 +70,25 @@ export const ScatterChartConfig = (function () {
6970
}
7071
},
7172
singleAxis: props.singleAxis,
72-
divider: props.divider,
73+
boundaryGap: props.boundaryGap,
7374
};
7475
}
7576
)
7677
.setPropertyViewFn((children) => (
7778
<>
7879
{showLabelPropertyView(children)}
80+
{children.showLabel.getView() && children.labelIndex.propertyView({
81+
label: trans("scatterChart.labelIndex"),
82+
})}
83+
{children.boundaryGap.propertyView({
84+
label: trans("scatterChart.boundaryGap"),
85+
})}
7986
{children.shape.propertyView({
8087
label: trans("chart.scatterShape"),
8188
})}
8289
{children.singleAxis.propertyView({
8390
label: trans("scatterChart.singleAxis"),
8491
})}
85-
{children.singleAxis.getView() && children.divider.propertyView({
86-
label: trans("scatterChart.divider"),
87-
})}
8892
</>
8993
))
9094
.build();

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

+16-5
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ export function getSeriesConfig(props: EchartsConfigProps) {
118118
config.coordinateSystem = 'singleAxis';
119119
config.singleAxisIndex = index;
120120
config.data = [];
121-
config.symbolSize = function(dataItem) {
122-
return dataItem[1] / props.chartConfig.divider;
123-
}
124121
}
125122
if(s.effect) config.type = "effectScatter";
126123
if(s.symbolSize) config.symbolSize = s.symbolSize;
124+
if(s.dynamicSize) config.symbolSize = function(dataItem) {
125+
return dataItem[s.dynamicIndex] / s.divider;
126+
}
127127
return config;
128128
});
129129
}
@@ -172,8 +172,19 @@ export function getEchartsConfig(
172172
...gridPos,
173173
containLabel: true,
174174
},
175-
xAxis: {},
176-
yAxis: {},
175+
xAxis: {
176+
type: "category",
177+
boundaryGap: props.chartConfig.boundaryGap,
178+
splitLine: {
179+
show: !props.chartConfig.boundaryGap,
180+
},
181+
axisLine: {
182+
show: props.chartConfig.boundaryGap,
183+
}
184+
},
185+
yAxis: {
186+
type: "category",
187+
},
177188
};
178189

179190
if (props.data.length <= 0) {

‎client/packages/lowcoder-comps/src/comps/scatterChartComp/seriesComp.tsx

+13-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ export function newSeries(name: string, columnName: string): SeriesDataType {
3939
const seriesChildrenMap = {
4040
columnName: StringControl,
4141
seriesName: StringControl,
42+
dynamicSize: BoolControl,
4243
symbolSize: NumberControl,
44+
dynamicIndex: withDefault(NumberControl, "1"),
45+
divider: withDefault(NumberControl, 1000),
4346
effect: BoolControl,
4447
showMarkLine: BoolControl,
4548
markLineFrom: withDefault(StringControl, "[0,0]"),
@@ -76,7 +79,16 @@ class SeriesComp extends SeriesTmpComp {
7679
{this.children.effect.propertyView({
7780
label: trans("scatterChart.effect"),
7881
})}
79-
{this.children.symbolSize.propertyView({
82+
{this.children.dynamicSize.propertyView({
83+
label: trans("scatterChart.dynamicSize"),
84+
})}
85+
{this.children.dynamicSize.getView() && this.children.dynamicIndex.propertyView({
86+
label: trans("scatterChart.dynamicIndex"),
87+
})}
88+
{this.children.dynamicSize.getView() && this.children.divider.propertyView({
89+
label: trans("scatterChart.divider"),
90+
})}
91+
{!this.children.dynamicSize.getView() && this.children.symbolSize.propertyView({
8092
label: trans("scatterChart.symbolSize"),
8193
})}
8294
{this.children.showMarkLine.propertyView({

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

+4
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,10 @@ export const en = {
379379
labelLineLength2: "Label Line Length2",
380380
},
381381
scatterChart: {
382+
boundaryGap: "Boundary Gap",
383+
labelIndex: "Label Column Index",
384+
dynamicSize: "Dynamic Size",
385+
dynamicIndex: "Size Column Index",
382386
divider: "Divider",
383387
singleAxis: "Single Axis",
384388
effect: "Effect",

0 commit comments

Comments
 (0)