Home / Function/ ChartComposedTable() — supabase Function Reference

ChartComposedTable() — supabase Function Reference

Architecture documentation for the ChartComposedTable() function in chart-composed-table.tsx from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/design-system/__registry__/default/block/chart-composed-table.tsx lines 20–106

export default function ChartComposedTable() {
  const [isLoading, setIsLoading] = useState(true)

  const actions = [
    {
      label: 'Open in Logs Explorer',
      onClick: () => {
        alert('Opening in Logs Explorer...')
      },
      icon: <ExternalLink size={12} />,
    },
  ]

  const data = Array.from({ length: 46 }, (_, i) => {
    const date = new Date()
    date.setMinutes(date.getMinutes() - i * 5) // Each point 5 minutes apart

    return {
      timestamp: date.toISOString(),
      standard_score: Math.floor(Math.random() * 100),
    }
  }).reverse()

  useEffect(() => {
    setTimeout(() => {
      setIsLoading(false)
    }, 1000)
  }, [])

  return (
    <div className="flex flex-col gap-6 w-8/12">
      <Chart isLoading={isLoading}>
        <ChartCard>
          <ChartHeader>
            <ChartTitle tooltip="This is a tooltip">Standard Bar Chart</ChartTitle>
            <ChartActions actions={actions} />
          </ChartHeader>
          <ChartContent
            isEmpty={data.length === 0}
            emptyState={
              <ChartEmptyState
                icon={<BarChart2 size={16} />}
                title="No data to show"
                description="It may take up to 24 hours for data to refresh"
              />
            }
            loadingState={<ChartLoadingState />}
          >
            <div className="h-40">
              <ChartBar
                data={data}
                dataKey="standard_score"
                showGrid={false}
                showYAxis={true}
                YAxisProps={{
                  tickFormatter: (value) => `${value}k`,
                  width: 80,
                }}
                isFullHeight={true}
              />
            </div>
          </ChartContent>
          <ChartFooter>
            <Table>
              <TableHeader>
                <TableRow>
                  <TableHead>Timestamp</TableHead>
                  <TableHead className="text-right">Standard Score</TableHead>
                </TableRow>
              </TableHeader>
              <TableBody>
                {data.slice(0, 3).map((item) => (
                  <TableRow key={item.timestamp}>
                    <TableCell className="text-foreground-light">
                      {format(new Date(item.timestamp), 'MMM d, yyyy h:mm a')}
                    </TableCell>
                    <TableCell className="text-right tabular-nums">{item.standard_score}</TableCell>
                  </TableRow>
                ))}
              </TableBody>
            </Table>
          </ChartFooter>
        </ChartCard>
      </Chart>
    </div>
  )
}

Domain

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free