Skip to content

Commit 3af9b02

Browse files
committed
Fixed the ability to input static/dynamic data via data fields added.
1 parent ad00227 commit 3af9b02

File tree

8 files changed

+155
-152
lines changed

8 files changed

+155
-152
lines changed

client/packages/lowcoder-comps/src/comps/basicChartComp/chartUtils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,7 @@ export function getEchartsConfig(
212212
.map((s) => s.getView().columnName);
213213
// y-axis is category and time, data doesn't need to aggregate
214214
const transformedData =
215-
yAxisConfig.type === "category" || yAxisConfig.type === "time" ? props.echartsData : transformData(props.echartsData, props.xAxisKey, seriesColumnNames)
216-
||
217-
yAxisConfig.type === "category" || yAxisConfig.type === "time" ? props.data : transformData(props.data, props.xAxisKey, seriesColumnNames);
215+
yAxisConfig.type === "category" || yAxisConfig.type === "time" ? props.echartsData.length && props.echartsData || props.data : transformData(props.echartsData.length && props.echartsData || props.data, props.xAxisKey, seriesColumnNames);
218216
config = {
219217
...config,
220218
dataset: [

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

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export function getEchartsConfig(
149149
}
150150
},
151151
backgroundColor: parseBackground( props?.chartStyle?.background || theme?.chartStyle?.backgroundColor || "#FFFFFF"),
152-
color: props?.echartsOption.data?.map(data => data.color),
152+
color: props?.echartsData.data?.map(data => data.color) || props?.echartsOption.data?.map(data => data.color),
153153
tooltip: props?.tooltip && {
154154
trigger: "axis",
155155
axisPointer: {
@@ -178,7 +178,7 @@ export function getEchartsConfig(
178178
splitArea: props?.axisFlagVisibility && {
179179
show: true,
180180
areaStyle: {
181-
color: props?.echartsOption?.axisColor
181+
color: props?.echartsData?.axisColor || props?.echartsOption?.axisColor
182182
}
183183
},
184184
axisLabel: {
@@ -187,12 +187,12 @@ export function getEchartsConfig(
187187
},
188188
xAxis: props?.echartsOption && {
189189
type: 'category',
190-
data: props?.echartsOption.xAxis && props?.echartsOption.xAxis.data,
190+
data: props?.echartsData.xAxis && props?.echartsOption.xAxis.data,
191191
splitArea: !props?.axisFlagVisibility && {
192192
show: true,
193193
areaStyle: {
194194
// Provide multiple colors to alternate through
195-
color: props?.echartsOption?.axisColor
195+
color: props?.echartsData?.axisColor || props?.echartsOption?.axisColor
196196
},
197197
},
198198
axisLabel: {
@@ -205,7 +205,7 @@ export function getEchartsConfig(
205205
},
206206
// Show split areas, each day with a different background color
207207
},
208-
series: props?.echartsOption && [
208+
series: props?.echartsData || props?.echartsOption && [
209209
{
210210
name: props?.echartsConfig.type,
211211
type: props?.echartsConfig.type,
@@ -214,7 +214,16 @@ export function getEchartsConfig(
214214
position: props?.echartsLabelConfig.top
215215
},
216216
data: props?.echartsData?.data || props?.echartsOption.data,
217-
itemStyle: {
217+
itemStyle: props?.echartsData.itemStyle ? {
218+
...props?.echartsData.itemStyle,
219+
borderWidth: props?.chartStyle?.chartBorderWidth || theme?.chartStyle?.borderWidth,
220+
borderType: props?.chartStyle?.chartBorderStyle || theme?.chartStyle?.borderType,
221+
borderRadius: Number(props?.chartStyle?.chartBorderRadius || theme?.chartStyle?.borderRadius),
222+
shadowColor: props?.chartStyle?.chartShadowColor || theme?.chartStyle?.shadowColor,
223+
shadowBlur: props?.chartStyle?.chartBoxShadow?.split('px')[0] || theme?.chartStyle?.boxShadow?.split('px')[0],
224+
shadowOffsetX: props?.chartStyle?.chartBoxShadow?.split('px')[1] || theme?.chartStyle?.boxShadow?.split('px')[1],
225+
shadowOffsetY: props?.chartStyle?.chartBoxShadow?.split('px')[2] || theme?.chartStyle?.boxShadow?.split('px')[2]
226+
} : {
218227
...props?.echartsOption.itemStyle,
219228
borderWidth: props?.chartStyle?.chartBorderWidth || theme?.chartStyle?.borderWidth,
220229
borderType: props?.chartStyle?.chartBorderStyle || theme?.chartStyle?.borderType,

client/packages/lowcoder-comps/src/comps/chartComp/chartUtils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,7 @@ export function getEchartsConfig(
212212
.map((s) => s.getView().columnName);
213213
// y-axis is category and time, data doesn't need to aggregate
214214
const transformedData =
215-
yAxisConfig.type === "category" || yAxisConfig.type === "time" ? props.echartsData : transformData(props.echartsData, props.xAxisKey, seriesColumnNames)
216-
||
217-
yAxisConfig.type === "category" || yAxisConfig.type === "time" ? props.data : transformData(props.data, props.xAxisKey, seriesColumnNames);
215+
yAxisConfig.type === "category" || yAxisConfig.type === "time" ? props.echartsData.length && props.echartsData || props.data : transformData(props.echartsData.length && props.echartsData || props.data, props.xAxisKey, seriesColumnNames);
218216
config = {
219217
...config,
220218
dataset: [

client/packages/lowcoder-comps/src/comps/funnelChartComp/funnelChartUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,13 @@ export function getEchartsConfig(
148148
}
149149
},
150150
"backgroundColor": parseBackground( props?.chartStyle?.background || theme?.chartStyle?.backgroundColor || "#FFFFFF"),
151-
"color": props.echartsOption.data?.map(data => data.color),
151+
"color": props.echartsData.data?.map(data => data.color) || props.echartsOption.data?.map(data => data.color),
152152
"tooltip": props.tooltip&&{
153153
"trigger": "item",
154154
"formatter": "{a} <br/>{b} : {c}%"
155155
},
156156
"legend":props.legendVisibility&& {
157-
"data": props.echartsOption.data?.map(data=>data.name),
157+
"data": props.echartsData.data?.map(data=>data.name) || props.echartsOption.data?.map(data=>data.name),
158158
"top": props.echartsLegendConfig.top,
159159
"left": props.echartsLegendAlignConfig.left,
160160
"orient": props.echartsLegendOrientConfig.orient,

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export function gaugeChartPropertyView(
8383
const stageGaugePropertyView = (
8484
<>
8585
<Section name={trans("chart.config")}>
86-
{children.echartsData.propertyView({ label: trans("chart.data") })}
86+
{children.gradeGaugeData.propertyView({ label: trans("chart.data") })}
8787
{children.chartType.propertyView({label: trans("gaugeChart.chartType"), tooltip: trans("gaugeChart.chartTypeTooltip") })}
8888
{children.echartsTitleConfig.getPropertyView()}
8989
{children.echartsTitle.propertyView({ label: trans("gaugeChart.title"), tooltip: trans("echarts.titleTooltip") })}
@@ -150,7 +150,7 @@ export function gaugeChartPropertyView(
150150
const gradeGaugePropertyView = (
151151
<>
152152
<Section name={trans("chart.config")}>
153-
{children.echartsData.propertyView({ label: trans("chart.data") })}
153+
{children.gradeGaugeData.propertyView({ label: trans("chart.data") })}
154154
{children.chartType.propertyView({label: trans("gaugeChart.chartType"), tooltip: trans("gaugeChart.chartTypeTooltip") })}
155155
{children.echartsTitleConfig.getPropertyView()}
156156
{children.echartsTitle.propertyView({ label: trans("gaugeChart.title"), tooltip: trans("echarts.titleTooltip") })}
@@ -217,7 +217,7 @@ export function gaugeChartPropertyView(
217217
const temperatureGaugePropertyView = (
218218
<>
219219
<Section name={trans("chart.config")}>
220-
{children.echartsData.propertyView({ label: trans("chart.data") })}
220+
{children.temperatureGaugeData.propertyView({ label: trans("chart.data") })}
221221
{children.chartType.propertyView({label: trans("gaugeChart.chartType"), tooltip: trans("gaugeChart.chartTypeTooltip") })}
222222
{children.echartsTitleConfig.getPropertyView()}
223223
{children.echartsTitle.propertyView({ label: trans("gaugeChart.title"), tooltip: trans("echarts.titleTooltip") })}
@@ -285,7 +285,7 @@ export function gaugeChartPropertyView(
285285
const multiGaugePropertyView = (
286286
<>
287287
<Section name={trans("chart.config")}>
288-
{children.echartsData.propertyView({ label: trans("chart.data") })}
288+
{children.multiTitleGaugeData.propertyView({ label: trans("chart.data") })}
289289
{children.chartType.propertyView({label: trans("gaugeChart.chartType"), tooltip: trans("gaugeChart.chartTypeTooltip") })}
290290
{children.echartsTitleConfig.getPropertyView()}
291291
{children.echartsTitle.propertyView({ label: trans("gaugeChart.title"), tooltip: trans("echarts.titleTooltip") })}
@@ -350,7 +350,7 @@ export function gaugeChartPropertyView(
350350
const ringGaugePropertyView = (
351351
<>
352352
<Section name={trans("chart.config")}>
353-
{children.echartsData.propertyView({ label: trans("chart.data") })}
353+
{children.ringGaugeData.propertyView({ label: trans("chart.data") })}
354354
{children.chartType.propertyView({label: trans("gaugeChart.chartType"), tooltip: trans("gaugeChart.chartTypeTooltip") })}
355355
{children.echartsTitleConfig.getPropertyView()}
356356
{children.echartsTitle.propertyView({ label: trans("gaugeChart.title"), tooltip: trans("echarts.titleTooltip") })}
@@ -405,7 +405,7 @@ export function gaugeChartPropertyView(
405405
const barometerGaugePropertyView = (
406406
<>
407407
<Section name={trans("chart.config")}>
408-
{children.echartsData.propertyView({ label: trans("chart.data") })}
408+
{children.barometerGaugeData.propertyView({ label: trans("chart.data") })}
409409
{children.chartType.propertyView({label: trans("gaugeChart.chartType"), tooltip: trans("gaugeChart.chartTypeTooltip") })}
410410
{children.echartsTitleConfig.getPropertyView()}
411411
{children.echartsTitle.propertyView({ label: trans("gaugeChart.title"), tooltip: trans("echarts.titleTooltip") })}
@@ -464,7 +464,7 @@ export function gaugeChartPropertyView(
464464
const clockGaugePropertyView = (
465465
<>
466466
<Section name={trans("chart.config")}>
467-
{children.echartsData.propertyView({ label: trans("chart.data") })}
467+
{children.clockGaugeData.propertyView({ label: trans("chart.data") })}
468468
{children.chartType.propertyView({label: trans("gaugeChart.chartType"), tooltip: trans("gaugeChart.chartTypeTooltip") })}
469469
{children.echartsTitleConfig.getPropertyView()}
470470
{children.echartsTitle.propertyView({ label: trans("gaugeChart.title"), tooltip: trans("echarts.titleTooltip") })}

0 commit comments

Comments
 (0)