Skip to content

Commit 8970461

Browse files
committed
Fixed background Color and built type structure of gauge chart.
1 parent dcaa670 commit 8970461

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
@@ -232,6 +232,41 @@ const EchartsOptionMap = {
232232
gauge: GaugeChartConfig,
233233
};
234234

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

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

0 commit comments

Comments
 (0)