Skip to main content
Glama
LineChart.tsx1.1 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import type { ChartData } from 'chart.js'; import { lazy, Suspense } from 'react'; import type { JSX } from 'react'; const lineChartOptions = { responsive: true, scales: { y: { min: 0, }, }, plugins: { legend: { position: 'bottom' as const, }, }, }; interface LineChartProps { readonly chartData: ChartData<'line', number[]>; } const AsyncLine = lazy(async () => { const { CategoryScale, Chart, Legend, LinearScale, LineElement, PointElement, Title, Tooltip } = await import('chart.js'); Chart.register(CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend); const { Line } = await import('react-chartjs-2'); return { default: Line }; }); export function LineChart({ chartData }: LineChartProps): JSX.Element { return ( <div className="my-5"> <Suspense fallback={<div>Loading...</div>}> <AsyncLine options={lineChartOptions} data={chartData} /> </Suspense> </div> ); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/medplum/medplum'

If you have feedback or need assistance with the MCP directory API, please join our Discord server