Skip to content

Commit d92c816

Browse files
committed
Fixed stack bar error
1 parent 0580fe4 commit d92c816

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

client/packages/lowcoder-comps/src/comps/barChartComp/barChartUtils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export function isAxisChart(type: CharOptionCompType, subtype: string) {
7171
}
7272

7373
export function getSeriesConfig(props: EchartsConfigProps) {
74+
console.log("SeriesProps:", props);
7475
let visibleSeries = props.series.filter((s) => !s.getView().hide);
7576
if(props.chartConfig.subtype === "waterfall") {
7677
const seriesOn = visibleSeries[0];
@@ -307,7 +308,7 @@ export function getEchartsConfig(
307308
axisLabel: {
308309
...styleWrapper(props?.xAxisStyle, theme?.xAxisStyle, 11)
309310
},
310-
data: finalXyConfig.xConfig.type === "category"?props?.xAxisData:undefined,
311+
data: finalXyConfig.xConfig.type === "category" && (props.xAxisData as []).length!==0?props?.xAxisData:undefined,
311312
},
312313
// @ts-ignore
313314
yAxis: {

client/packages/lowcoder-comps/src/comps/basicChartComp/chartConfigs/barChartConfig.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ const BarTypeOptions = [
2020
label: trans("chart.basicBar"),
2121
value: "basicBar",
2222
},
23-
{
24-
label: trans("chart.stackedBar"),
25-
value: "stackedBar",
26-
},
2723
{
2824
label: trans("chart.waterfallBar"),
2925
value: "waterfall",
@@ -48,6 +44,7 @@ export const BarChartConfig = (function () {
4844
polarStartAngle: withDefault(NumberControl, 90),
4945
polarEndAngle: withDefault(NumberControl, -180),
5046
polarIsTangent: withDefault(BoolControl, false),
47+
stack: withDefault(BoolControl, false),
5148
race: withDefault(BoolControl, false),
5249
labelData: jsonControl(toArray, []),
5350
},
@@ -78,7 +75,7 @@ export const BarChartConfig = (function () {
7875
},
7976
race: props.race,
8077
};
81-
if (props.type === "stackedBar") {
78+
if (props.stack) {
8279
config.stack = "stackValue";
8380
}
8481
if (props.type === "waterfall") {
@@ -108,6 +105,9 @@ export const BarChartConfig = (function () {
108105
{children.race.propertyView({
109106
label: trans("barChart.race"),
110107
})}
108+
{children.stack.propertyView({
109+
label: trans("barChart.stack"),
110+
})}
111111
{children.showBackground.propertyView({
112112
label: trans("barChart.showBg"),
113113
})}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ export const en = {
316316
title: 'Title',
317317
barWidth: 'Bar Width(%)',
318318
race: 'Race',
319+
stack: 'Stacked',
319320
showBg: 'Show Bar Background',
320321
bgColor: 'Background Color',
321322
polarIsTangent: 'Tangential Chart',

0 commit comments

Comments
 (0)