← คอมโพเนนต์ทั้งหมด

ไทม์ไลน์

เล่น เลื่อน และเร่งความเร็วเหตุการณ์ตามเวลา พร้อมเครื่องหมายและกราฟเส้นย่อ

ตัวอย่างทำงานบนคลังข้อมูลประเทศไทยสาธารณะของ MapScale

ติดตั้ง

npx shadcn@latest add https://mapscale.io/r/timeline.json

วิธีใช้

import { Timeline } from "@/components/mapscale/timeline"

const [value, setValue] = useState(start)
const [playing, setPlaying] = useState(false)

<Timeline
	start={start}
	end={end}
	value={value}
	onChange={setValue}
	playing={playing}
	onPlayingChange={setPlaying}
	events={[{ time: start + 3 * DAY, label: "First report", color: "#e11d48" }]}
/>

พร็อพ

พร็อพชนิดค่าเริ่มต้นคำอธิบาย
startnumber-First timestamp (ms).
endnumber-Last timestamp (ms).
valuenumber-Current timestamp (ms). Controlled.
onChange(value) => void-Called while scrubbing or playing.
playingboolean-Whether playback is running. Controlled.
onPlayingChange(playing) => void-Called when play, pause or the end of the range is reached.
speed1 | 2 | 5 | 101Playback multiplier: 1, 2, 5 or 10.
eventsTimelineEvent[]-Ticks on the scrubber: { time, label, color }.
seriesTimelineSeries[]-Optional sparklines: { label, points: [t, v][] }.

คีย์

แผนที่ การค้นหาที่อยู่ และรายละเอียดสถานที่ใช้คีย์ pk_ ที่ปลอดภัยบนเบราว์เซอร์ ส่วนเส้นทางและ isochrone ต้องใช้คีย์ลับ sk_ จึงต้องผ่านเส้นทางพร็อกซีบนเซิร์ฟเวอร์ของแอปคุณ