Set up Bun React AG Charts app

This commit is contained in:
zwgczx committed 2026-05-06 15:01:58 +08:00
1 parent bbc8692e7f
commit 4afad5fe10
5 files changed
+285 -13

No files matched your search

+6 -6
View File
@@ -1,6 +1,6 @@
import { useMemo, useState } from 'react';
import { AgCharts } from 'ag-charts-react';
import type { AgChartOptions } from 'ag-charts-community';
import type { AgCartesianChartOptions } from 'ag-charts-community';
const revenueData = [
{ month: '1月', revenue: 146, orders: 92, margin: 36 },
@@ -14,7 +14,7 @@ const revenueData = [
function App() {
const [chartType, setChartType] = useState<'bar' | 'line'>('bar');
const chartOptions = useMemo<AgChartOptions>(
const chartOptions = useMemo<AgCartesianChartOptions>(
() => ({
title: {
text: '业务趋势',
@@ -49,19 +49,19 @@ function App() {
stroke: '#d97706',
},
],
axes: [
{
axes: {
x: {
type: 'category',
position: 'bottom',
},
{
y: {
type: 'number',
position: 'left',
title: {
text: '数值',
},
},
],
},
legend: {
position: 'bottom',
},