Skip to content

Commit 6384363

Browse files
committed
Added datazoom, grid to candleStick chart.
1 parent 03bc7bd commit 6384363

File tree

5 files changed

+64
-23
lines changed

5 files changed

+64
-23
lines changed

client/packages/lowcoder-comps/src/comps/candleStickChartComp/candleStickChartConstants.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,15 @@ let chartJsonModeChildren: any = {
257257
echartsLabelConfig: EchartsLabelConfig,
258258
echartsTitleConfig:EchartsTitleConfig,
259259
echartsConfig: EchartsOptionComp,
260-
// style: styleControl(EchartsStyle, 'style'),
260+
left:withDefault(NumberControl,trans('candleStickChart.defaultLeft')),
261+
right:withDefault(NumberControl,trans('candleStickChart.defaultRight')),
262+
top:withDefault(NumberControl,trans('candleStickChart.defaultTop')),
263+
bottom:withDefault(NumberControl,trans('candleStickChart.defaultBottom')),
264+
dataZoomBottom:withDefault(NumberControl,trans('candleStickChart.defaultDataZoomBottom')),
265+
dataZoomHeight:withDefault(NumberControl,trans('candleStickChart.defaultDataZoomHeight')),
261266
tooltip: withDefault(BoolControl, true),
262267
legendVisibility: withDefault(BoolControl, true),
268+
dataZoomVisibility: withDefault(BoolControl, true),
263269
}
264270
if (EchartsStyle) {
265271
chartJsonModeChildren = {

client/packages/lowcoder-comps/src/comps/candleStickChartComp/candleStickChartPropertyView.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,17 @@ export function candleStickChartPropertyView(
3232
),
3333
})}
3434
{children.echartsTitleConfig.getPropertyView()}
35-
{children.legendVisibility.getView()&& children.echartsLegendConfig.getPropertyView()}
35+
{children.left.propertyView({ label: trans("candleStickChart.left") })}
36+
{children.right.propertyView({ label: trans("candleStickChart.right") })}
37+
{children.top.propertyView({ label: trans("candleStickChart.top") })}
38+
{children.bottom.propertyView({ label: trans("candleStickChart.bottom") })}
39+
{children.legendVisibility.getView() && children.echartsLegendConfig.getPropertyView()}
3640
{children.echartsTitle.propertyView({ label: trans("candleStickChart.title") })}
41+
{children.dataZoomVisibility.getView() && children.dataZoomHeight.propertyView({ label: trans("candleStickChart.dataZoomHeight") })}
42+
{children.dataZoomVisibility.getView() && children.dataZoomBottom.propertyView({ label: trans("candleStickChart.dataZoomBottom") })}
3743
{children.tooltip.propertyView({label: trans("candleStickChart.tooltip")})}
38-
{children.legendVisibility.propertyView({label: trans("funnelChart.legendVisibility")})}
44+
{children.legendVisibility.propertyView({label: trans("candleStickChart.legendVisibility")})}
45+
{children.dataZoomVisibility.propertyView({label: trans("candleStickChart.dataZoomVisibility")})}
3946
</Section>
4047
<Section name={sectionNames.interaction}>
4148
{children.onEvent.propertyView()}
@@ -46,7 +53,7 @@ export function candleStickChartPropertyView(
4653
<Section name={sectionNames.layout}>{hiddenPropertyView(children)}
4754
</Section>
4855

49-
<Section name={sectionNames.chartStyle}> //chart's style
56+
<Section name={sectionNames.chartStyle}>
5057
{children.chartStyle?.getPropertyView()}
5158
</Section>
5259
<Section name={sectionNames.titleStyle}>
@@ -55,9 +62,12 @@ export function candleStickChartPropertyView(
5562
<Section name={sectionNames.labelStyle}>
5663
{children.labelStyle?.getPropertyView()}
5764
</Section>
58-
<Section name={sectionNames.legendStyle}>
59-
{children.legendStyle?.getPropertyView()}
60-
</Section>
65+
{
66+
children.legendVisibility.getView() ?
67+
<Section name={sectionNames.legendStyle}>
68+
{children.legendStyle?.getPropertyView()}
69+
</Section> : <></>
70+
}
6171
</>
6272
);
6373

client/packages/lowcoder-comps/src/comps/candleStickChartComp/candleStickChartUtils.ts

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,30 +161,41 @@ export function getEchartsConfig(
161161
}
162162
},
163163
"backgroundColor": getBackgroundColor(backgroundColor, gradientColor, opacity, direction),
164-
"color": props.echartsOption.data?.map(data => data.color),
165-
"tooltip": props.tooltip&&{
164+
"color": props?.echartsOption.data?.map(data => data.color),
165+
"tooltip": props?.tooltip&&{
166166
"trigger": "axis",
167167
"axisPointer": {
168168
"type": "cross"
169169
}
170170
},
171171
"grid": {
172-
"left": "10%",
173-
"right": "10%",
174-
"bottom": "10%",
172+
"left": `${props?.left}%`,
173+
"right": `${props?.right}%`,
174+
"bottom": `${props?.bottom}%`,
175+
"top": `${props?.top}%`,
175176
},
177+
"dataZoom": [
178+
{
179+
"show": props?.dataZoomVisibility,
180+
"type": 'slider',
181+
"start": 0,
182+
"end": 100,
183+
"bottom": props?.dataZoomBottom,
184+
'height': props?.dataZoomHeight
185+
}
186+
],
176187
"xAxis": {
177188
"type": "category",
178-
"data": props.echartsOption.xAxis.data
189+
"data": props?.echartsOption.xAxis.data
179190
},
180191
"yAxis": {
181192
"type": "value",
182193
"scale": true
183194
},
184195
"series": [
185196
{
186-
"name": props.echartsConfig.type,
187-
"type": props.echartsConfig.type,
197+
"name": props?.echartsConfig.type,
198+
"type": props?.echartsConfig.type,
188199
"left": "10%",
189200
"top": 60,
190201
"bottom": 60,
@@ -194,9 +205,9 @@ export function getEchartsConfig(
194205
"gap": 2,
195206
"label": {
196207
"show": true,
197-
"position": props.echartsLabelConfig.top
208+
"position": props?.echartsLabelConfig.top
198209
},
199-
"data": props.echartsOption.data,
210+
"data": props?.echartsOption.data,
200211
}
201212
]
202213
}

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@ export const en = {
5252
title: 'Title',
5353
defaultTitle: 'CandleStick Chart',
5454
tooltip: 'Tooltip',
55+
legendVisibility: 'Legend Visibility',
56+
dataZoomVisibility: 'Data Zoom Visibility',
57+
left: 'Left',
58+
defaultLeft:'10',
59+
right: 'Right',
60+
defaultRight:'10',
61+
top: 'Top',
62+
defaultTop:'20',
63+
bottom: 'Bottom',
64+
defaultBottom:'20',
65+
defaultDataZoomBottom: '20',
66+
dataZoomBottom: 'Data Zoom Bottom',
67+
defaultDataZoomHeight: '15',
68+
dataZoomHeight: 'Data Zoom Height'
5569
},
5670
sankeyChart: {
5771
sankeyType: 'Sankey Chart Type',
@@ -79,7 +93,7 @@ export const en = {
7993
defaultMax:'100',
8094
gap: 'Gap',
8195
defaultGap: '2',
82-
label:'Label',
96+
label:'Label Visibility',
8397
opacity: 'Opacity',
8498
defaultOpacity: '1',
8599

client/packages/lowcoder-comps/src/util/gradientBackgroundColor.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import opacityToHex from "./opacityToHex";
22

33
const getBackgroundColor = (
4-
backgroundColor = '',
5-
gradientColor = '',
6-
opacity = '',
7-
direction = '',
4+
backgroundColor: any,
5+
gradientColor: any,
6+
opacity: any,
7+
direction: any,
88
) => {
99
if (direction?.split(' ').length < 4)
1010
return gradientColor && backgroundColor
1111
? {
12-
"type": 'radical',
12+
"type": 'radial',
1313
"x": direction?.split(' ')[0],
1414
"y": direction?.split(' ')[1],
1515
"r": direction?.split(' ')[2],

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy