-
Notifications
You must be signed in to change notification settings - Fork 307
Expand file tree
/
Copy pathboxplotChartPropertyView.tsx
More file actions
102 lines (100 loc) · 3.53 KB
/
Copy pathboxplotChartPropertyView.tsx
File metadata and controls
102 lines (100 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import { changeChildAction, CompAction } from "lowcoder-core";
import { ChartCompChildrenType, getDataKeys } from "./boxplotChartConstants";
import {
CustomModal,
Dropdown,
hiddenPropertyView,
Option,
RedButton,
Section,
sectionNames,
controlItem,
} from "lowcoder-sdk";
import { trans } from "i18n/comps";
export function boxplotChartPropertyView(
children: ChartCompChildrenType,
dispatch: (action: CompAction) => void
) {
const columnOptions = getDataKeys(children.data.getView()).map((key) => ({
label: key,
value: key,
}));
const uiModePropertyView = (
<>
<Section name={trans("chart.data")}>
<Dropdown
value={children.xAxisKey.getView()}
options={columnOptions}
label={trans("chart.xAxis")}
onChange={(value) => {
dispatch(changeChildAction("xAxisKey", value));
}}
/>
<Dropdown
value={children.yAxisKey.getView()}
options={columnOptions}
label={trans("chart.yAxis")}
onChange={(value) => {
dispatch(changeChildAction("yAxisKey", value));
}}
/>
</Section>
<Section name={sectionNames.interaction}>
<div style={{display: 'flex', flexDirection: 'column', gap: '8px'}}>
{children.onUIEvent.propertyView({title: trans("chart.chartEventHandlers")})}
</div>
<div style={{display: 'flex', flexDirection: 'column', gap: '8px'}}>
{children.onEvent.propertyView()}
</div>
</Section>
<Section name={sectionNames.layout}>
{children.echartsTitleConfig.getPropertyView()}
{children.echartsTitleVerticalConfig.getPropertyView()}
{children.legendConfig.getPropertyView()}
{children.title.propertyView({ label: trans("chart.title") })}
{children.left.propertyView({ label: trans("chart.left"), tooltip: trans("echarts.leftTooltip") })}
{children.right.propertyView({ label: trans("chart.right"), tooltip: trans("echarts.rightTooltip") })}
{children.top.propertyView({ label: trans("chart.top"), tooltip: trans("echarts.topTooltip") })}
{children.bottom.propertyView({ label: trans("chart.bottom"), tooltip: trans("echarts.bottomTooltip") })}
{hiddenPropertyView(children)}
{children.tooltip.propertyView({label: trans("echarts.tooltip"), tooltip: trans("echarts.tooltipTooltip")})}
</Section>
<Section name={sectionNames.chartStyle}>
{children.chartStyle?.getPropertyView()}
</Section>
<Section name={sectionNames.titleStyle}>
{children.titleStyle?.getPropertyView()}
</Section>
<Section name={sectionNames.xAxisStyle}>
{children.xAxisStyle?.getPropertyView()}
</Section>
<Section name={sectionNames.yAxisStyle}>
{children.yAxisStyle?.getPropertyView()}
</Section>
<Section name={sectionNames.advanced}>
{children.data.propertyView({
label: trans("chart.data"),
enableAIHelp: true,
aiHelp: {
targetKind: "json",
label: "Box plot chart data",
fieldName: "data",
fieldDescription:
"JSON array of objects for the box plot. Include keys for category (x) and numeric columns used for box plot statistics.",
},
})}
</Section>
</>
);
const getChatConfigByMode = (mode: string) => {
switch(mode) {
case "ui":
return uiModePropertyView;
}
}
return (
<>
{getChatConfigByMode(children.mode.getView())}
</>
);
}