Skip to content

Commit 843045c

Browse files
committed
Added roundCap, theme setting to Gauge chart.
1 parent e46c7f6 commit 843045c

File tree

5 files changed

+21
-18
lines changed

5 files changed

+21
-18
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ GaugeChartTmpComp = withViewFn(GaugeChartTmpComp, (comp) => {
146146
return getEchartsConfig(
147147
childrenToProps(echartsConfigChildren) as ToViewReturn<typeof echartsConfigChildren>,
148148
chartSize,
149-
theme?.theme?.components?.candleStickChart || {},
149+
themeConfig
150150
);
151151
}, [chartSize, ...Object.values(echartsConfigChildren)]);
152152

@@ -176,7 +176,6 @@ GaugeChartTmpComp = withViewFn(GaugeChartTmpComp, (comp) => {
176176
lazyUpdate
177177
opts={{ locale: getEchartsLocale() }}
178178
option={option}
179-
theme={mode !== 'map' ? themeConfig : undefined}
180179
mode={mode}
181180
/>
182181
</ReactResizeDetector>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ let chartJsonModeChildren: any = {
262262
legendVisibility: withDefault(BoolControl, true),
263263
label: withDefault(BoolControl, true),
264264
progressBar: withDefault(BoolControl, true),
265+
roundCap: withDefault(BoolControl, true),
265266
left:withDefault(NumberControl,trans('gaugeChart.defaultLeft')),
266267
top:withDefault(NumberControl,trans('gaugeChart.defaultTop')),
267268
bottom:withDefault(NumberControl,trans('gaugeChart.defaultBottom')),

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export function gaugeChartPropertyView(
5151
{/* {children.gap.propertyView({ label: trans("gaugeChart.gap") })} */}
5252
{children.tooltip.propertyView({ label: trans("gaugeChart.tooltip") })}
5353
{children.progressBar.propertyView({ label: trans("gaugeChart.progressBar") })}
54+
{children.roundCap.propertyView({ label: trans("gaugeChart.roundCap") })}
5455
</Section>
5556
<Section name={sectionNames.interaction}>
5657
{children.onEvent.propertyView()}

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

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export function getEchartsConfig(
174174
"trigger": "item",
175175
"formatter": "{a} <br/>{b} : {c}%"
176176
},
177+
"color": props?.echartsOption?.data?.map(data => data.color),
177178
"series": [
178179
{
179180
"name": props.echartsConfig.type,
@@ -182,7 +183,7 @@ export function getEchartsConfig(
182183
"left": `${props.left}%`,
183184
"top": props.top,
184185
"bottom": props.bottom,
185-
"width": `${props.left}%`,
186+
"width":`${props.left}%`,
186187
"min": props.min,
187188
"max": props.max,
188189
"gap": props.gap,
@@ -195,8 +196,7 @@ export function getEchartsConfig(
195196
"width": props?.pointerWidth,
196197
},
197198
"itemStyle": {
198-
"color": props.echartsOption.data?.map(data => data.color),
199-
"opacity": props.opacity,
199+
"opacity": props?.opacity,
200200
"borderColor": props?.chartStyle?.chartBorderColor || theme?.chartStyle?.borderColor,
201201
"borderWidth": props?.chartStyle?.chartBorderWidth || theme?.chartStyle?.borderWidth,
202202
"borderType": props?.chartStyle?.chartBorderStyle || theme?.chartStyle?.borderType,
@@ -207,27 +207,27 @@ export function getEchartsConfig(
207207
"shadowOffsetY": props?.chartStyle?.chartBoxShadow?.split('px')[2] || theme?.chartStyle?.boxShadow?.split('px')[2]
208208
},
209209
"progress": {
210-
"roundCap": true,
210+
"roundCap": props.roundCap,
211211
"show": props?.progressBar,
212212
"width": props?.progressBarWidth
213213
},
214214
"axisLine": {
215-
"roundCap": true,
215+
"roundCap": props.roundCap,
216216
"lineStyle": {
217217
"width": props?.progressBarWidth
218218
}
219219
},
220220
"axisLabel": {
221-
"distance": props?.progressBarWidth + "10", // Distance of the labels from the axis
222-
"fontFamily": props?.axixLabelStyle?.chartFontFamily || theme?.axixLabelStyle?.fontFamily,
223-
"fontSize": props?.axixLabelStyle?.chartTextSize || theme?.axixLabelStyle?.fontSize || 12,
224-
"fontWeight": props?.axixLabelStyle?.chartTextWeight || theme?.axixLabelStyle?.fontWeight,
225-
"color": props?.axixLabelStyle?.chartTextColor || theme?.axixLabelStyle?.fontColor || "#000000",
226-
"fontStyle": props?.axixLabelStyle?.chartFontStyle || theme?.axixLabelStyle?.fontStyle,
227-
"textShadowColor": props?.axixLabelStyle?.chartShadowColor || theme?.axixLabelStyle?.shadowColor,
228-
"textShadowBlur": props?.axixLabelStyle?.chartBoxShadow?.split('px')[0] || theme?.axixLabelStyle?.boxShadow?.split('px')[0],
229-
"textShadowOffsetX": props?.axixLabelStyle?.chartBoxShadow?.split('px')[1] || theme?.axixLabelStyle?.boxShadow?.split('px')[1],
230-
"textShadowOffsetY": props?.axixLabelStyle?.chartBoxShadow?.split('px')[2] || theme?.axixLabelStyle?.boxShadow?.split('px')[2]
221+
"distance": Number(props?.progressBarWidth) + 10,
222+
"fontFamily": props?.axisLabelStyle?.chartFontFamily || theme?.axisLabelStyle?.fontFamily,
223+
"fontSize": props?.axisLabelStyle?.chartTextSize || theme?.axisLabelStyle?.fontSize || 12,
224+
"fontWeight": props?.axisLabelStyle?.chartTextWeight || theme?.axisLabelStyle?.fontWeight,
225+
"color": props?.axisLabelStyle?.chartTextColor || theme?.axisLabelStyle?.fontColor || "#000000",
226+
"fontStyle": props?.axisLabelStyle?.chartFontStyle || theme?.axisLabelStyle?.fontStyle,
227+
"textShadowColor": props?.axisLabelStyle?.chartShadowColor || theme?.axisLabelStyle?.shadowColor,
228+
"textShadowBlur": props?.axisLabelStyle?.chartBoxShadow?.split('px')[0] || theme?.axisLabelStyle?.boxShadow?.split('px')[0],
229+
"textShadowOffsetX": props?.axisLabelStyle?.chartBoxShadow?.split('px')[1] || theme?.axisLabelStyle?.boxShadow?.split('px')[1],
230+
"textShadowOffsetY": props?.axisLabelStyle?.chartBoxShadow?.split('px')[2] || theme?.axisLabelStyle?.boxShadow?.split('px')[2]
231231
},
232232
'detail': {
233233
"fontFamily": props?.legendStyle?.chartFontFamily || theme?.legendStyle?.fontFamily,
@@ -245,7 +245,8 @@ export function getEchartsConfig(
245245
"position": props.echartsLabelConfig.top,
246246
},
247247
"data": props.echartsOption.data?.map(item => ({
248-
...item,
248+
"value": item.value,
249+
"name": item.name,
249250
title: {
250251
"fontFamily": props?.labelStyle?.chartFontFamily || theme?.labelStyle?.fontFamily,
251252
"fontSize": props?.labelStyle?.chartTextSize || theme?.labelStyle?.fontSize,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export const en = {
123123
progressBarWidth: 'Progress Bar Width',
124124
defaultProgressBarWidth: '10',
125125
progressBar: 'Progress Bar',
126+
roundCap: 'Round Cap',
126127
},
127128
echarts: {
128129
defaultTitle: "Data Display",

0 commit comments

Comments
 (0)