Skip to content

Commit e32c71b

Browse files
committed
legend config
1 parent f0774bd commit e32c71b

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import {
2+
AlignBottom,
3+
AlignTop,
4+
dropdownControl,
5+
MultiCompBuilder,
6+
} from "lowcoder-sdk";
7+
import { LegendComponentOption } from "echarts";
8+
import { trans } from "i18n/comps";
9+
10+
const LegendPositionOptions = [
11+
{
12+
label: <AlignBottom />,
13+
value: "bottom",
14+
},
15+
{
16+
label: <AlignTop />,
17+
value: "top",
18+
},
19+
] as const;
20+
21+
export const EchartsLegendConfig = (function () {
22+
return new MultiCompBuilder(
23+
{
24+
position: dropdownControl(LegendPositionOptions, "bottom"),
25+
},
26+
(props): LegendComponentOption => {
27+
const config: LegendComponentOption = {
28+
top: "bottom",
29+
type: "scroll",
30+
};
31+
config.top = props.position
32+
return config;
33+
}
34+
)
35+
.setPropertyViewFn((children) => (
36+
<>
37+
{children.position.propertyView({
38+
label: trans("echarts.legendPosition"),
39+
radioButton: true,
40+
})}
41+
</>
42+
))
43+
.build();
44+
})();

0 commit comments

Comments
 (0)