Skip to content

Commit ffcef3c

Browse files
committed
Improve Line Chart
1 parent 0fd92c4 commit ffcef3c

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

client/packages/lowcoder-comps/src/comps/lineChartComp/lineChartComp.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,13 @@ export const LineChartCompWithDefault = withDefault(LineChartComp, {
302302
series: [
303303
{
304304
dataIndex: genRandomKey(),
305-
seriesName: trans("chart.spending"),
306-
columnName: "spending",
305+
seriesName: "Sales",
306+
columnName: "sales",
307307
},
308308
{
309309
dataIndex: genRandomKey(),
310-
seriesName: trans("chart.budget"),
311-
columnName: "budget",
310+
seriesName: "Growth",
311+
columnName: "growth",
312312
},
313313
],
314314
});

client/packages/lowcoder-comps/src/comps/lineChartComp/lineChartConstants.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,19 @@ export const XAxisDirectionOptions = [
8383

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

86+
export const defaultChartData = [
87+
{ date: "Jan", sales: 320, growth: 250 },
88+
{ date: "Feb", sales: 450, growth: 300 },
89+
{ date: "Mar", sales: 380, growth: 340 },
90+
{ date: "Apr", sales: 520, growth: 400 },
91+
{ date: "May", sales: 480, growth: 450 },
92+
{ date: "Jun", sales: 600, growth: 500 }
93+
];
8694
export const noDataAxisConfig = {
8795
animation: false,
8896
xAxis: {
8997
type: "category",
90-
name: trans("chart.noData"),
98+
name: "No Data Available",
9199
nameLocation: "middle",
92100
data: [],
93101
axisLine: {
@@ -243,8 +251,8 @@ const EchartsOptionComp = withType(EchartsOptionMap, "funnel");
243251
export type CharOptionCompType = keyof typeof ChartOptionMap;
244252

245253
export const chartUiModeChildren = {
246-
title: withDefault(StringControl, trans("echarts.defaultTitle")),
247-
data: jsonControl(toJSONObjectArray, i18nObjs.defaultDataSource),
254+
title: withDefault(StringControl, trans("lineChart.defaultTitle")),
255+
data: jsonControl(toJSONObjectArray, defaultChartData),
248256
xAxisKey: valueComp<string>(""), // x-axis, key from data
249257
xAxisDirection: dropdownControl(XAxisDirectionOptions, "horizontal"),
250258
xAxisData: jsonControl(toArray, []),

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ export const en = {
317317

318318
},
319319
lineChart: {
320+
title: 'Title',
321+
defaultTitle: 'Line Chart',
320322
cellSize: "Cell Size",
321323
range: "Range",
322324
markLines: "Mark Lines",

0 commit comments

Comments
 (0)