Skip to content

Commit 3c3806f

Browse files
committed
title config
1 parent 26ec313 commit 3c3806f

File tree

1 file changed

+49
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)