Skip to content

Commit bedbbc1

Browse files
committed
label style
1 parent af0b599 commit bedbbc1

File tree

3 files changed

+61
-26
lines changed

3 files changed

+61
-26
lines changed

‎client/packages/lowcoder-comps/src/comps/pieChartComp/pieChartUtils.ts

+6
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ export function getSeriesConfig(props: EchartsConfigProps) {
7777
endAngle: s.getView().endAngle,
7878
name: s.getView().seriesName,
7979
selectedMode: "single",
80+
label: {
81+
position: s.getView().labelPosition,
82+
alignTo: s.getView().labelAlignTo,
83+
bleedMargin: s.getView().labelBleedMargin,
84+
edgeDistance: s.getView().labelEdgeDistance,
85+
},
8086
encode: {
8187
itemName: props.xAxisKey,
8288
value: s.getView().columnName,

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

+44-26
Original file line numberDiff line numberDiff line change
@@ -33,55 +33,61 @@ export function newSeries(name: string, columnName: string): SeriesDataType {
3333
};
3434
}
3535

36-
export function newMarkLine(type: string): MarkLineDataType {
37-
return {
38-
type,
39-
dataIndex: genRandomKey(),
40-
};
41-
}
42-
43-
export const MarkLineTypeOptions = [
36+
export const RoseTypeOptions = [
4437
{
45-
label: trans("pieChart.max"),
46-
value: "max",
38+
label: trans("pieChart.radius"),
39+
value: "radius",
4740
},
4841
{
49-
label: trans("pieChart.average"),
50-
value: "average",
42+
label: trans("pieChart.area"),
43+
value: "area",
5144
},
5245
{
53-
label: trans("pieChart.min"),
54-
value: "min",
46+
label: trans("pieChart.none"),
47+
value: "none",
5548
},
5649
] as const;
5750

58-
export const RoseTypeOptions = [
51+
export const LabelAlignToOptions = [
5952
{
60-
label: trans("pieChart.radius"),
61-
value: "radius",
53+
label: trans("pieChart.none"),
54+
value: "none",
6255
},
6356
{
64-
label: trans("pieChart.area"),
65-
value: "area",
57+
label: trans("pieChart.labelLine"),
58+
value: "labelLine",
6659
},
6760
{
68-
label: trans("pieChart.none"),
69-
value: "none",
61+
label: trans("pieChart.edge"),
62+
value: "edge",
7063
},
7164
] as const;
7265

73-
export function newMarkArea(): MarkLineDataType {
74-
return {
75-
dataIndex: genRandomKey(),
76-
};
77-
}
66+
export const LabelPositionOptions = [
67+
{
68+
label: trans("pieChart.outer"),
69+
value: "outer",
70+
},
71+
{
72+
label: trans("pieChart.inner"),
73+
value: "inner",
74+
},
75+
{
76+
label: trans("pieChart.center"),
77+
value: "center",
78+
},
79+
] as const;
7880

7981
const seriesChildrenMap = {
8082
columnName: StringControl,
8183
seriesName: StringControl,
8284
startAngle: withDefault(NumberControl, 0),
8385
endAngle: withDefault(NumberControl, 360),
8486
roseType: dropdownControl(RoseTypeOptions, "none"),
87+
labelAlignTo: dropdownControl(LabelAlignToOptions, "none"),
88+
labelPosition: dropdownControl(LabelPositionOptions, "outer"),
89+
labelBleedMargin: withDefault(NumberControl, 5),
90+
labelEdgeDistance: withDefault(StringControl, '25%'),
8591
hide: BoolControl,
8692
// unique key, for sort
8793
dataIndex: valueComp<string>(""),
@@ -119,6 +125,18 @@ class SeriesComp extends SeriesTmpComp {
119125
{this.children.roseType.propertyView({
120126
label: trans("pieChart.roseType"),
121127
})}
128+
{this.children.labelPosition.propertyView({
129+
label: trans("pieChart.labelPosition"),
130+
})}
131+
{this.children.labelAlignTo.propertyView({
132+
label: trans("pieChart.labelAlignTo"),
133+
})}
134+
{this.children.labelBleedMargin.propertyView({
135+
label: trans("pieChart.labelBleedMargin"),
136+
})}
137+
{this.children.labelEdgeDistance.propertyView({
138+
label: trans("pieChart.labelEdgeDistance"),
139+
})}
122140
</>
123141
);
124142
}

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

+11
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,17 @@ export const en = {
352352
area: "Area",
353353
radius: "Radius",
354354
none: "None",
355+
labelPosition: "Position",
356+
labelAlignTo: "AlignTo",
357+
labelBleedMargin: "Bleed Margin",
358+
labelEdgeDistance: "Edge Distance",
359+
labelLine: "Label Line",
360+
edge: "Edge",
361+
outside: "Outside",
362+
outer: "Outer",
363+
inside: "Inside",
364+
inner: "Inner",
365+
center: "Center",
355366
},
356367
barChart: {
357368
title: 'Title',

0 commit comments

Comments
 (0)