-
Notifications
You must be signed in to change notification settings - Fork 308
Expand file tree
/
Copy pathcandleStickChartPropertyView.tsx
More file actions
106 lines (103 loc) · 4.57 KB
/
Copy pathcandleStickChartPropertyView.tsx
File metadata and controls
106 lines (103 loc) · 4.57 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
103
104
105
106
import { CompAction } from "lowcoder-core";
import { ChartCompChildrenType } from "./candleStickChartConstants";
import {
hiddenPropertyView,
Section,
sectionNames,
} from "lowcoder-sdk";
import { trans } from "i18n/comps";
import { examplesUrl,optionUrl } from "../chartComp/chartConfigs/chartUrls";
export function candleStickChartPropertyView(
children: ChartCompChildrenType,
dispatch: (action: CompAction) => void
) {
const jsonModePropertyView = (
<>
<Section name={trans("chart.config")}>
{children.echartsData.propertyView({
label: trans("chart.data"),
enableAIHelp: true,
aiHelp: {
targetKind: "json",
label: "CandleStick chart data",
fieldName: "echartsData",
fieldDescription:
"JSON array of OHLC values. Each item is [open, close, low, high] for one period, in the same order as x-axis labels.",
},
})}
{children.echartsTitleConfig.getPropertyView()}
{children.echartsTitleData.propertyView({
label: trans("chart.xAxisLabels"),
tooltip: trans("chart.xAxisLabelsTooltip"),
enableAIHelp: true,
aiHelp: {
targetKind: "json",
label: "CandleStick x-axis labels",
fieldName: "echartsTitleData",
fieldDescription:
"JSON array of x-axis labels (e.g. dates). Length must match the number of OHLC rows in Data.",
},
})}
{children.echartsTitleVerticalConfig.getPropertyView()}
{children.echartsTitle.propertyView({ label: trans("candleStickChart.title"), tooltip: trans("echarts.titleTooltip") })}
{children.left.propertyView({ label: trans("candleStickChart.left"), tooltip: trans("echarts.leftTooltip") })}
{children.right.propertyView({ label: trans("candleStickChart.right"), tooltip: trans("echarts.rightTooltip") })}
{children.top.propertyView({ label: trans("candleStickChart.top"), tooltip: trans("echarts.topTooltip") })}
{children.bottom.propertyView({ label: trans("candleStickChart.bottom"), tooltip: trans("echarts.bottomTooltip") })}
{children.dataZoomVisibility.getView() && children.dataZoomHeight.propertyView({ label: trans("candleStickChart.dataZoomHeight"), tooltip: trans("candleStickChart.dataZoomHeightTooltip") })}
{children.dataZoomVisibility.getView() && children.dataZoomBottom.propertyView({ label: trans("candleStickChart.dataZoomBottom"), tooltip: trans("candleStickChart.dataZoomBottomTooltip") })}
{children.axisFlagVisibility.propertyView({label: trans("candleStickChart.axisFlagVisibility"), tooltip: trans("candleStickChart.axisFlagVisibilityTooltip") })}
{children.dataZoomVisibility.propertyView({label: trans("candleStickChart.dataZoomVisibility"), tooltip: trans("candleStickChart.dataZoomVisibilityTooltip") })}
</Section>
<Section name={sectionNames.interaction}>
{children.onEvent.propertyView()}
</Section>
<Section name={sectionNames.layout}>{hiddenPropertyView(children)}
</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.echartsOption.propertyView({
label: trans("chart.echartsOptionLabel"),
styleName: "higher",
language: "json",
enableAIHelp: true,
aiHelp: {
targetKind: "echarts-option",
label: "CandleStick option",
fieldName: "echartsOption",
fieldDescription: "Apache ECharts option JSON for this chart component.",
},
tooltip: (
<div>
<a href={optionUrl} target="_blank" rel="noopener noreferrer">
{trans("chart.echartsOptionTooltip")}
</a>
<br />
<a href={examplesUrl} target="_blank" rel="noopener noreferrer">
{trans("chart.echartsOptionExamples")}
</a>
</div>
),
})}
</Section>
</>
);
const getChatConfigByMode = (mode: string) => {
switch(mode) {
case "json":
return jsonModePropertyView;
}
}
return getChatConfigByMode(children.mode.getView())
}