Skip to content

Commit ff2db4b

Browse files
ReynardoEWmintdart
andauthored
allow chart zoom (#2271)
* chart zoom * update height --------- Co-authored-by: mintdart <[email protected]>
1 parent bca38e9 commit ff2db4b

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

src/containers/LlamaAI/components/ChartRenderer.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ const SingleChart = memo(function SingleChart({ config, data, isActive }: Single
141141
grid: {
142142
top: 24,
143143
right: 12,
144-
bottom: 12,
144+
bottom: 68,
145145
left: 12
146146
},
147147
tooltip: {
@@ -233,12 +233,11 @@ const SingleChart = memo(function SingleChart({ config, data, isActive }: Single
233233
],
234234
title: config.title,
235235
valueSymbol: config.valueSymbol || '$',
236-
height: '300px',
237-
hideDataZoom: true,
236+
height: '360px',
238237
xAxisType: 'category',
239238
chartOptions: {
240239
grid: {
241-
bottom: 12,
240+
bottom: 68,
242241
left: 12,
243242
right: 12
244243
},

src/containers/LlamaAI/utils/chartAdapter.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function adaptPieChartData(config: ChartConfiguration, rawData: any[]): AdaptedC
178178
const pieProps: Partial<IPieChartProps> = {
179179
title: config.title,
180180
chartData: pieData,
181-
height: '300px',
181+
height: '360px',
182182
stackColors,
183183
valueSymbol: config.valueSymbol ?? '',
184184
showLegend: true
@@ -196,7 +196,7 @@ function adaptPieChartData(config: ChartConfiguration, rawData: any[]): AdaptedC
196196
return {
197197
chartType: 'pie',
198198
data: [],
199-
props: { title: 'Pie Chart Error', height: '300px' },
199+
props: { title: 'Pie Chart Error', height: '360px' },
200200
title: config.title || 'Pie Chart Error',
201201
description: `Failed to render pie chart: ${error instanceof Error ? error.message : 'Unknown error'}`
202202
}
@@ -247,7 +247,7 @@ function adaptScatterChartData(config: ChartConfiguration, rawData: any[]): Adap
247247
xAxisLabel,
248248
yAxisLabel,
249249
valueSymbol: config.valueSymbol || '',
250-
height: '300px',
250+
height: '360px',
251251
tooltipFormatter: (params: any) => {
252252
if (params.value.length >= 2) {
253253
const xValue = params.value[0]
@@ -271,7 +271,7 @@ function adaptScatterChartData(config: ChartConfiguration, rawData: any[]): Adap
271271
return {
272272
chartType: 'scatter',
273273
data: [],
274-
props: { chartData: [], title: 'Scatter Chart Error', height: '300px' },
274+
props: { chartData: [], title: 'Scatter Chart Error', height: '360px' },
275275
title: config.title || 'Scatter Chart Error',
276276
description: `Failed to render scatter chart: ${error instanceof Error ? error.message : 'Unknown error'}`
277277
}
@@ -332,8 +332,7 @@ export function adaptChartData(config: ChartConfiguration, rawData: any[]): Adap
332332
title: config.title,
333333
valueSymbol: config.valueSymbol ?? '',
334334
color,
335-
height: '300px',
336-
hideDataZoom: true,
335+
height: '360px',
337336
hideDownloadButton: false,
338337
tooltipSort: true,
339338

@@ -350,7 +349,7 @@ export function adaptChartData(config: ChartConfiguration, rawData: any[]): Adap
350349
grid: {
351350
top: 12,
352351
right: 12,
353-
bottom: 12,
352+
bottom: 68,
354353
left: 12
355354
},
356355
tooltip: {
@@ -401,7 +400,7 @@ export function adaptChartData(config: ChartConfiguration, rawData: any[]): Adap
401400
return {
402401
chartType: 'area',
403402
data: [],
404-
props: { title: 'Chart Error', height: '300px' },
403+
props: { title: 'Chart Error', height: '360px' },
405404
title: config.title || 'Chart Error',
406405
description: `Failed to render chart: ${error instanceof Error ? error.message : 'Unknown error'}`
407406
}
@@ -475,8 +474,7 @@ export function adaptMultiSeriesData(config: ChartConfiguration, rawData: any[])
475474
const multiSeriesProps: Partial<IMultiSeriesChartProps> = {
476475
series: validSeries,
477476
title: config.title,
478-
height: '300px',
479-
hideDataZoom: true,
477+
height: '360px',
480478
hideDownloadButton: false,
481479
valueSymbol: config.valueSymbol ?? '',
482480
xAxisType: config.axes.x.type === 'value' ? 'category' : config.axes.x.type,
@@ -489,7 +487,7 @@ export function adaptMultiSeriesData(config: ChartConfiguration, rawData: any[])
489487
grid: {
490488
top: 24,
491489
right: 12,
492-
bottom: 12,
490+
bottom: 68,
493491
left: 12
494492
},
495493
tooltip: {
@@ -533,7 +531,7 @@ export function adaptMultiSeriesData(config: ChartConfiguration, rawData: any[])
533531
props: {
534532
series: [],
535533
title: 'Chart Error',
536-
height: '300px'
534+
height: '360px'
537535
},
538536
title: config.title || 'Chart Error',
539537
description: `Failed to render multi-series chart: ${error instanceof Error ? error.message : 'Unknown error'}`

0 commit comments

Comments
 (0)