Skip to content

Commit 7d0bc85

Browse files
committed
Fixed background Color and built type structure of gauge chart.
1 parent 9d1d607 commit 7d0bc85

File tree

5 files changed

+615
-16
lines changed

5 files changed

+615
-16
lines changed

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

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,38 +135,62 @@ export function getEchartsConfig(
135135
chartSize?: ChartSize,
136136
theme?: any,
137137
): EChartsOptionWithMap {
138+
139+
138140
if (props.mode === "json") {
139141
let opt={
140142
"title": {
141143
"text": props.echartsTitle,
142144
'top': props.echartsLegendConfig.top === 'bottom' ?'top':'bottom',
143-
"left":"center"
145+
"left":props.echartsTitleConfig.top,
146+
"textStyle": {
147+
"fontFamily": props?.titleStyle?.chartFontFamily || theme?.titleStyle?.fontFamily,
148+
"fontSize": props?.titleStyle?.chartTextSize || theme?.titleStyle?.fontSize || '18',
149+
"fontWeight": props?.titleStyle?.chartTextWeight || theme?.titleStyle?.fontWeight,
150+
"color": props?.titleStyle?.chartTextColor || theme?.titleStyle?.fontColor || "#000000",
151+
"fontStyle": props?.titleStyle?.chartFontStyle || theme?.titleStyle?.fontStyle,
152+
"textShadowColor": props?.titleStyle?.chartShadowColor || theme?.titleStyle?.shadowColor,
153+
"textShadowBlur": props?.titleStyle?.chartBoxShadow?.split('px')[0] || theme?.titleStyle?.boxShadow?.split('px')[0],
154+
"textShadowOffsetX": props?.titleStyle?.chartBoxShadow?.split('px')[1] || theme?.titleStyle?.boxShadow?.split('px')[1],
155+
"textShadowOffsetY": props?.titleStyle?.chartBoxShadow?.split('px')[2] || theme?.titleStyle?.boxShadow?.split('px')[2]
156+
}
144157
},
145-
"backgroundColor": parseBackground( props?.style?.background || theme?.style?.background || "#FFFFFF"),
146-
"color": props.echartsOption.data?.map(data => data.color),
147-
"tooltip": props.tooltip&&{
158+
"backgroundColor": parseBackground( props?.chartStyle?.background || theme?.chartStyle?.backgroundColor || "#FFFFFF"),
159+
"color": props?.echartsOption.data?.map(data => data.color),
160+
"tooltip": props?.tooltip&&{
148161
"trigger": "axis",
149162
"axisPointer": {
150163
"type": "cross"
151164
}
152165
},
153166
"grid": {
154-
"left": "10%",
155-
"right": "10%",
156-
"bottom": "10%",
167+
"left": `${props?.left}%`,
168+
"right": `${props?.right}%`,
169+
"bottom": `${props?.bottom}%`,
170+
"top": `${props?.top}%`,
157171
},
172+
"dataZoom": [
173+
{
174+
"show": props?.dataZoomVisibility,
175+
"type": 'slider',
176+
"start": 0,
177+
"end": 100,
178+
"bottom": props?.dataZoomBottom,
179+
'height': props?.dataZoomHeight
180+
}
181+
],
158182
"xAxis": {
159183
"type": "category",
160-
"data": props.echartsOption.xAxis.data
184+
"data": props?.echartsOption.xAxis.data
161185
},
162186
"yAxis": {
163187
"type": "value",
164188
"scale": true
165189
},
166190
"series": [
167191
{
168-
"name": props.echartsConfig.type,
169-
"type": props.echartsConfig.type,
192+
"name": props?.echartsConfig.type,
193+
"type": props?.echartsConfig.type,
170194
"left": "10%",
171195
"top": 60,
172196
"bottom": 60,
@@ -176,9 +200,9 @@ export function getEchartsConfig(
176200
"gap": 2,
177201
"label": {
178202
"show": true,
179-
"position": props.echartsLabelConfig.top
203+
"position": props?.echartsLabelConfig.top
180204
},
181-
"data": props.echartsOption.data,
205+
"data": props?.echartsOption.data,
182206
}
183207
]
184208
}

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,41 @@ const EchartsOptionMap = {
233233
gauge: GaugeChartConfig,
234234
};
235235

236+
const ChartTypeOptions = [
237+
{
238+
label: trans("chart.default"),
239+
value: "default",
240+
},
241+
{
242+
label: trans("chart.stageGauge"),
243+
value: "stageGauge",
244+
},
245+
{
246+
label: trans("chart.gradeGauge"),
247+
value: "gradeGauge",
248+
},
249+
{
250+
label: trans("chart.temperatureGauge"),
251+
value: "temperatureGauge",
252+
},
253+
{
254+
label: trans("chart.multiGauge"),
255+
value: "multiGauge",
256+
},
257+
{
258+
label: trans("chart.ringGauge"),
259+
value: "ringGauge",
260+
},
261+
{
262+
label: trans("chart.barometerGauge"),
263+
value: "barometerGauge",
264+
},
265+
{
266+
label: trans("chart.clockGauge"),
267+
value: "clockGauge",
268+
},
269+
] as const;
270+
236271
const ChartOptionComp = withType(ChartOptionMap, "bar");
237272
const EchartsOptionComp = withType(EchartsOptionMap, "gauge");
238273
export type CharOptionCompType = keyof typeof ChartOptionMap;
@@ -252,6 +287,7 @@ export const chartUiModeChildren = {
252287

253288
let chartJsonModeChildren: any = {
254289
echartsOption: jsonControl(toObject, i18nObjs.defaultGaugeChartOption),
290+
chartType: dropdownControl(ChartTypeOptions, trans("chart.default")),
255291
echartsTitle: withDefault(StringControl, trans("gaugeChart.defaultTitle")),
256292
echartsLegendConfig: EchartsLegendConfig,
257293
echartsLabelConfig: EchartsLabelConfig,

0 commit comments

Comments
 (0)