Skip to content

Commit ce78c15

Browse files
committed
Improve Pie Chart Data
1 parent 5a6a55f commit ce78c15

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

client/packages/lowcoder-comps/src/comps/pieChartComp/pieChartConstants.tsx

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,41 @@ export const XAxisDirectionOptions = [
8282

8383
export type XAxisDirectionType = ValueFromOption<typeof XAxisDirectionOptions>;
8484

85+
// Add this new code block:
86+
// Realistic pie chart demo data with proper categories and values
87+
export const defaultPieChartData = [
88+
{
89+
category: "Market Share",
90+
name: "Samsung",
91+
value: 21.8
92+
},
93+
{
94+
category: "Market Share",
95+
name: "Apple",
96+
value: 20.5
97+
},
98+
{
99+
category: "Market Share",
100+
name: "Xiaomi",
101+
value: 13.4
102+
},
103+
{
104+
category: "Market Share",
105+
name: "Oppo",
106+
value: 8.8
107+
},
108+
{
109+
category: "Market Share",
110+
name: "Vivo",
111+
value: 8.1
112+
},
113+
{
114+
category: "Market Share",
115+
name: "Others",
116+
value: 27.4
117+
}
118+
];
119+
85120
export const noDataAxisConfig = {
86121
animation: false,
87122
xAxis: {
@@ -241,8 +276,8 @@ export type CharOptionCompType = keyof typeof ChartOptionMap;
241276

242277
export const chartUiModeChildren = {
243278
title: withDefault(StringControl, trans("echarts.defaultTitle")),
244-
data: jsonControl(toJSONObjectArray, i18nObjs.defaultDataSource),
245-
xAxisKey: valueComp<string>(""), // x-axis, key from data
279+
data: jsonControl(toJSONObjectArray, defaultPieChartData),
280+
xAxisKey: valueComp<string>("name"),
246281
xAxisDirection: dropdownControl(XAxisDirectionOptions, "horizontal"),
247282
xAxisData: jsonControl(toArray, []),
248283
series: SeriesListComp,

0 commit comments

Comments
 (0)