กราฟตราประทับ
SealChart
The signature chart: the university seal drawn from data. Twelve rays are the fiscal months, and the ring is the year's disbursement. Point at or focus a ray to read its month. Use it once per page, on the hero band in the accent colour.
กราฟเอกลักษณ์ของระบบ ตรามหาวิทยาลัยที่วาดจากข้อมูล รัศมี 12 แฉกคือ 12 เดือนของปีงบประมาณ และวงแหวนคือยอดเบิกจ่ายเทียบงบทั้งปี ใช้ไม่เกินหนึ่งครั้งต่อหน้า บนแถบหัวหน้าในสีรองของแอป เช่น หน้าแรก งานทั่วไปให้ใช้ LineChart หรือ BarChart ที่อ่านค่าได้ง่ายกว่า SealTotal และ SealMonthList ให้ข้อมูลเดียวกันเป็นข้อความ
import { SealChart, SealTotal, SealMonthList } from "@bsru/ui";ตัวอย่าง
ปีงบประมาณ 2569
ชี้หรือกด Tab ไปที่รัศมีเพื่ออ่านยอดของเดือนนั้น max คือเดือนที่สูงสุดของทุกปีที่แสดง เพื่อให้รัศมีเทียบกันข้ามปีได้
<SealChart
data={{
year: 2569,
budget: 72,
months: [3.2, 3.8, 4.1, 5.2, 4.6, 5.9, 6.4, 5.1, 5.8, 6.7, 7.2, 6.8],
}}
max={7.2}
/>| Prop | ค่าในตัวอย่างนี้ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|---|
| data* จำเป็น | ออบเจกต์ 3 ฟิลด์{
year: 2569,
budget: 72,
months: [3.2, 3.8, 4.1, 5.2, 4.6, 5.9, 6.4, 5.1, 5.8, 6.7, 7.2, 6.8],
} | SealYear | The fiscal year to draw. |
| max | 7.2 | number | Longest month across the years shown, so rays compare between years. |
ยอดรวมเทียบงบ
ยอดรวมของปีเทียบกับงบ เป็นข้อความหนึ่งบรรทัด
รวม 64.8 จากงบ 72.0 ล้านบาท
<SealTotal
data={{
year: 2569,
budget: 72,
months: [3.2, 3.8, 4.1, 5.2, 4.6, 5.9, 6.4, 5.1, 5.8, 6.7, 7.2, 6.8],
}}
/>| Prop | ค่าในตัวอย่างนี้ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|---|
| data* จำเป็น | ออบเจกต์ 3 ฟิลด์{
year: 2569,
budget: 72,
months: [3.2, 3.8, 4.1, 5.2, 4.6, 5.9, 6.4, 5.1, 5.8, 6.7, 7.2, 6.8],
} | SealYear | The fiscal year to total. |
ยอดรายเดือนเป็นรายการ
ให้ผู้ที่ไม่ได้ใช้เมาส์อ่านยอดทุกเดือนได้ วางไว้ใน details ข้างกราฟ
- ต.ค.3.2
- พ.ย.3.8
- ธ.ค.4.1
- ม.ค.5.2
- ก.พ.4.6
- มี.ค.5.9
- เม.ย.6.4
- พ.ค.5.1
- มิ.ย.5.8
- ก.ค.6.7
- ส.ค.7.2
- ก.ย.6.8
<SealMonthList
data={{
year: 2569,
budget: 72,
months: [3.2, 3.8, 4.1, 5.2, 4.6, 5.9, 6.4, 5.1, 5.8, 6.7, 7.2, 6.8],
}}
/>| Prop | ค่าในตัวอย่างนี้ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|---|
| data* จำเป็น | ออบเจกต์ 3 ฟิลด์{
year: 2569,
budget: 72,
months: [3.2, 3.8, 4.1, 5.2, 4.6, 5.9, 6.4, 5.1, 5.8, 6.7, 7.2, 6.8],
} | SealYear | The fiscal year to list. |
props ทั้งหมด
ตัวอย่างด้านบนใช้ props เพียงบางตัว ตารางนี้แสดงทุกตัวที่คอมโพเนนต์รับ พร้อมค่าเริ่มต้นและค่าที่ใช้ได้
SealChart
The signature chart: the university seal drawn from data. Twelve rays are the fiscal months, and the ring is the year's disbursement. Point at or focus a ray to read its month. Use it once per page, on the hero band in the accent colour.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| data* จำเป็น | SealYear | — | The fiscal year to draw. |
| max | number | — | Longest month across the years shown, so rays compare between years. |
| className | string | — | Extra classes for the SVG, which always fills its width. |
SealTotal
The year's total against its budget, as one line of text.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| data* จำเป็น | SealYear | — | The fiscal year to total. |
| className | string | — | Classes for the paragraph, such as its text colour. |
SealMonthList
The seal chart's months as a list, for reading without pointing.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| data* จำเป็น | SealYear | — | The fiscal year to list. |
| className | string | — | Classes for the list, such as a grid layout. |
ชนิดข้อมูล
SealYear
One fiscal year for the seal chart, in million baht.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| year* จำเป็น | number | — | Buddhist-era fiscal year, such as 2569. |
| budget* จำเป็น | number | — | The year's budget in million baht, for the ring and the total. |
| months* จำเป็น | readonly number[] | — | Twelve monthly figures in fiscal order, October first. |
ข้อควรปฏิบัติ
- months ต้องมี 12 ค่า เรียงตามปีงบประมาณ เริ่มที่ตุลาคม
- ค่าทั้งหมดเป็นล้านบาท และ year เป็นปีพุทธศักราช
- วางกราฟบนแถบหัวหน้าสีเข้มในสีรองของแอป ตัวอักษรในกราฟเป็นสีขาว จึงอ่านไม่ออกบนพื้นขาว
- รัศมีขึ้นทีละเดือนครั้งเดียวเมื่อเปิดหน้า เป็นการเคลื่อนไหวเดียวของหน้า จึงใช้กราฟนี้หน้าละครั้ง
- หน้าที่มีกราฟต้องวาง <ChartPaints /> หนึ่งครั้ง ไม่เช่นนั้นรัศมีและวงแหวนจะไม่มีสี
- ข้อมูลในตัวอย่างและการทดสอบต้องเป็นข้อมูลสมมติ
ซอร์สโค้ด: ui/src/charts/seal.tsx