Skip to content

Commit 94c0f92

Browse files
committed
Updated Gauge Chart.
1 parent c14a22d commit 94c0f92

File tree

6 files changed

+29
-10
lines changed

6 files changed

+29
-10
lines changed

client/packages/lowcoder-comps/src/comps/gaugeChartComp/gaugeChartConstants.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ let chartJsonModeChildren: any = {
261261
tooltip: withDefault(BoolControl, true),
262262
legendVisibility: withDefault(BoolControl, true),
263263
label: withDefault(BoolControl, true),
264+
progressBar: withDefault(BoolControl, true),
264265
left:withDefault(NumberControl,trans('gaugeChart.defaultLeft')),
265266
top:withDefault(NumberControl,trans('gaugeChart.defaultTop')),
266267
bottom:withDefault(NumberControl,trans('gaugeChart.defaultBottom')),
@@ -269,13 +270,14 @@ let chartJsonModeChildren: any = {
269270
min:withDefault(NumberControl,trans('gaugeChart.defaultMin')),
270271
max:withDefault(NumberControl,trans('gaugeChart.defaultMax')),
271272
gap:withDefault(NumberControl,trans('gaugeChart.defaultGap')),
272-
positin_x:withDefault(NumberControl,trans('gaugeChart.position_x')),
273-
positin_y:withDefault(NumberControl,trans('gaugeChart.position_y')),
273+
position_x:withDefault(NumberControl,trans('gaugeChart.defaultPosition_X')),
274+
position_y:withDefault(NumberControl,trans('gaugeChart.defaultPosition_Y')),
274275
startAngle:withDefault(NumberControl,trans('gaugeChart.defaultStartAngle')),
275276
endAngle:withDefault(NumberControl,trans('gaugeChart.defaultEndAngle')),
276277
splitNumber:withDefault(NumberControl,trans('gaugeChart.defaultSplitNumber')),
277278
pointerLength:withDefault(NumberControl,trans('gaugeChart.defaultPointerLength')),
278279
pointerWidth:withDefault(NumberControl,trans('gaugeChart.defaultPointerWidth')),
280+
progressBarWidth:withDefault(NumberControl,trans('gaugeChart.defaultProgressBarWidth')),
279281

280282
}
281283
if (EchartsStyle) {

client/packages/lowcoder-comps/src/comps/gaugeChartComp/gaugeChartPropertyView.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ export function gaugeChartPropertyView(
4747
{children.splitNumber.propertyView({ label: trans("gaugeChart.splitNumber") })}
4848
{children.pointerLength.propertyView({ label: trans("gaugeChart.pointerLength") })}
4949
{children.pointerWidth.propertyView({ label: trans("gaugeChart.pointerWidth") })}
50+
{children.progressBar.getView() && children.progressBarWidth.propertyView({ label: trans("gaugeChart.progressBarWidth") })}
5051
{/* {children.gap.propertyView({ label: trans("gaugeChart.gap") })} */}
5152
{children.tooltip.propertyView({ label: trans("gaugeChart.tooltip") })}
53+
{children.progressBar.propertyView({ label: trans("gaugeChart.progressBar") })}
5254
</Section>
5355
<Section name={sectionNames.interaction}>
5456
{children.onEvent.propertyView()}
@@ -62,7 +64,7 @@ export function gaugeChartPropertyView(
6264
<Section name={sectionNames.labelStyle}>
6365
{children.labelStyle?.getPropertyView()}
6466
</Section>
65-
<Section name={sectionNames.legendStyle}>
67+
<Section name={sectionNames.detailStyle}>
6668
{children.legendStyle?.getPropertyView()}
6769
</Section>
6870
<Section name={sectionNames.layout}>{hiddenPropertyView(children)}</Section>

client/packages/lowcoder-comps/src/comps/gaugeChartComp/gaugeChartUtils.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,13 @@ export function getEchartsConfig(
186186
"min": props.min,
187187
"max": props.max,
188188
"gap": props.gap,
189-
"center": [`${props.position_x}%`, `${props.position_y}%`],
190-
"startAngle": props.startAngle,
191-
"endAngle": props.endAngle,
192-
"splitNumber": props.splitNumber,
189+
"center": [`${props?.position_x}%`, `${props?.position_y}%`],
190+
"startAngle": props?.startAngle,
191+
"endAngle": props?.endAngle,
192+
"splitNumber": props?.splitNumber,
193193
"pointer": {
194-
"length": `${props.pointerLength}%`,
195-
"width": props.pointerWidth,
194+
"length": `${props?.pointerLength}%`,
195+
"width": props?.pointerWidth,
196196
},
197197
"itemStyle": {
198198
"color": props.echartsOption.data?.map(data => data.color),
@@ -206,6 +206,17 @@ export function getEchartsConfig(
206206
"shadowOffsetX": props?.chartStyle?.chartBoxShadow?.split('px')[1] || theme?.chartStyle?.boxShadow?.split('px')[1],
207207
"shadowOffsetY": props?.chartStyle?.chartBoxShadow?.split('px')[2] || theme?.chartStyle?.boxShadow?.split('px')[2]
208208
},
209+
"progress": {
210+
"roundCap": true,
211+
"show": props?.progressBar,
212+
"width": props?.progressBarWidth
213+
},
214+
"axisLine": {
215+
"roundCap": true,
216+
"lineStyle": {
217+
"width": props?.progressBarWidth
218+
}
219+
},
209220
'detail': {
210221
"fontFamily": props?.legendStyle?.chartFontFamily || theme?.legendStyle?.fontFamily,
211222
"fontSize": props?.legendStyle?.chartTextSize || theme?.legendStyle?.fontSize || 16,

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ export const en = {
120120
defaultPosition_X: '50',
121121
position_y: 'Position-Y',
122122
defaultPosition_Y: '60',
123-
123+
progressBarWidth: 'Progress Bar Width',
124+
defaultProgressBarWidth: '10',
125+
progressBar: 'Progress Bar',
124126
},
125127
echarts: {
126128
defaultTitle: "Data Display",

client/packages/lowcoder-design/src/components/Section.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,5 @@ export const sectionNames = {
190190
chartStyle:trans("prop.chartStyle"),
191191
titleStyle:trans("prop.titleStyle"),
192192
legendStyle:trans("prop.legendStyle"),
193+
detailStyle:trans("prop.detailStyle"),
193194
};

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const en = {
4343
chartStyle: "Chart Style",
4444
titleStyle: "Title Style",
4545
legendStyle: "Legend Style",
46+
detailStyle: "Detail Style",
4647
},
4748
passwordInput: {
4849
label: "Password:",

0 commit comments

Comments
 (0)