Components / AI Dashboards
AI Latency Chart
A real-time latency monitoring chart showing AI API response times with min, max, and average indicators.
Components / AI Dashboards
A real-time latency monitoring chart showing AI API response times with min, max, and average indicators.
Average response time over last 24h
92ms
-8% from yesterday
Install the core libraries required for this component.
npm install react"use client";
import React from "react";
const points = [42, 65, 45, 80, 55, 90, 72, 85, 60, 95, 88, 112, 98, 124];
export default function AILatencyChart() {
const max = Math.max(...points);
const min = Math.min(...points);
return (
<div className="rounded-xl border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 p-6 shadow-sm w-full max-w-lg mx-auto">
<div className="flex items-center justify-between mb-8">
<div>
<h3 className="text-sm font-bold text-zinc-900 dark:text-zinc-100">API Latency</h3>
<p className="text-xs text-zinc-500 mt-1">Average response time over last 24h</p>
</div>
<div className="text-right">
<p className="text-lg font-bold text-blue-500">92ms</p>
<p className="text-[10px] text-zinc-400 uppercase font-bold tracking-widest">-8% from yesterday</p>
</div>
</div>
<div className="relative h-32 flex items-end gap-1 px-2">
{/* Simple grid lines */}
<div className="absolute inset-0 flex flex-col justify-between pointer-events-none opacity-20">
<div className="border-t border-zinc-500 w-full" />
<div className="border-t border-zinc-500 w-full" />
<div className="border-t border-zinc-500 w-full" />
</div>
{points.map((p, i) => (
<div key={i} className="flex-1 group relative flex flex-col items-center justify-end h-full">
<div
className="w-full bg-blue-500/20 group-hover:bg-blue-500/40 rounded-t-sm transition-all duration-300"
style={{ height: `${((p - min * 0.5) / (max - min * 0.5)) * 100}%` }}
/>
{/* Tooltip on hover */}
<div className="absolute -top-6 hidden group-hover:block bg-zinc-900 text-white text-[10px] py-1 px-1.5 rounded font-bold whitespace-nowrap z-10">
{p}ms
</div>
</div>
))}
</div>
</div>
);
} "use client";
import React from "react";
const points = [42, 65, 45, 80, 55, 90, 72, 85, 60, 95, 88, 112, 98, 124];
export default function AILatencyChart() {
const max = Math.max(...points);
const min = Math.min(...points);
return (
<div className="rounded-xl border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 p-6 shadow-sm w-full max-w-lg mx-auto">
<div className="flex items-center justify-between mb-8">
<div>
<h3 className="text-sm font-bold text-zinc-900 dark:text-zinc-100">API Latency</h3>
<p className="text-xs text-zinc-500 mt-1">Average response time over last 24h</p>
</div>
<div className="text-right">
<p className="text-lg font-bold text-blue-500">92ms</p>
<p className="text-[10px] text-zinc-400 uppercase font-bold tracking-widest">-8% from yesterday</p>
</div>
</div>
<div className="relative h-32 flex items-end gap-1 px-2">
{/* Simple grid lines */}
<div className="absolute inset-0 flex flex-col justify-between pointer-events-none opacity-20">
<div className="border-t border-zinc-500 w-full" />
<div className="border-t border-zinc-500 w-full" />
<div className="border-t border-zinc-500 w-full" />
</div>
{points.map((p, i) => (
<div key={i} className="flex-1 group relative flex flex-col items-center justify-end h-full">
<div
className="w-full bg-blue-500/20 group-hover:bg-blue-500/40 rounded-t-sm transition-all duration-300"
style={{ height: `${((p - min * 0.5) / (max - min * 0.5)) * 100}%` }}
/>
{/* Tooltip on hover */}
<div className="absolute -top-6 hidden group-hover:block bg-zinc-900 text-white text-[10px] py-1 px-1.5 rounded font-bold whitespace-nowrap z-10">
{p}ms
</div>
</div>
))}
</div>
</div>
);
} Internal functions used to handle component logic.
| Function | Parameters |
|---|---|
| AILatencyChart() | None |
All variable declarations found in this component.
| Name | Kind | Value |
|---|---|---|
| points | | [42, 65, 45, 80, 55, 90, 72, 85, 60, 95, 88, 112, 98, 124] |
| max | | Math.max(...points) |
| min | | Math.min(...points) |
Every JSX/HTML tag used in this component, with usage count and source.
| Tag | Count | Type | Source |
|---|---|---|---|
| <div> | 12× | | Native HTML |
| <h3> | 1× | | Native HTML |
| <p> | 3× | | Native HTML |