Skip to content

Hiển thị Lá số

Tạo hình ảnh lá số SVG và PNG đẹp mắt.

Lá số SVG

Tạo lá số tử vi SVG bằng các tham số truy vấn:

bash
curl -X GET "https://api.astroapi.cloud/api/chart/image.svg?width=800&height=800&dateTime=1990-06-15T14:30&location.longitude=-0.1278&location.latitude=51.5074&location.timezone=Europe/London" \
  -H "X-Api-Key: your-api-key"

Lá số PNG

Chuyển đổi sang định dạng PNG:

bash
curl -X GET "https://api.astroapi.cloud/api/chart/image.png?width=800&height=800&dateTime=1990-06-15T14:30&location.longitude=-0.1278&location.latitude=51.5074&location.timezone=Europe/London" \
  -H "X-Api-Key: your-api-key" \
  --output chart.png

Các Loại Lá số

EndpointMô tả
/api/chart/image.svgLá số tử vi dạng SVG
/api/chart/image.pngLá số tử vi dạng PNG
/api/chart/image.svg với tham số transit.*Lá số hai vòng quá độ
/api/chart/composite.svgLá số kết hợp (trung điểm)
/api/chart/composite.pngLá số kết hợp dạng PNG

Lá số Hai vòng Quá độ

Thêm các tham số quá độ để hiển thị lá số hai vòng với vòng tử vi (trong) và vòng quá độ (ngoài):

bash
curl -X GET "https://api.astroapi.cloud/api/chart/image.svg?width=800&height=800&dateTime=1990-06-15T14:30&location.longitude=-0.1278&location.latitude=51.5074&location.timezone=Europe/London&transit.dateTime=2024-01-15T12:00&transit.timezone=Europe/London" \
  -H "X-Api-Key: your-api-key"

Tham số Quá độ

Tham sốBắt buộcMô tả
transit.dateTimeNgày/giờ quá độ (YYYY-MM-DDTHH:mm)
transit.timezoneMúi giờ quá độ
transit.longitudeKhôngKinh độ vị trí quá độ (mặc định là tử vi)
transit.latitudeKhôngVĩ độ vị trí quá độ (mặc định là tử vi)

Lá số Kết hợp

Tạo lá số kết hợp cho thấy các trung điểm giữa hai lá số tử vi:

bash
curl -X GET "https://api.astroapi.cloud/api/chart/composite.svg?width=800&height=800&person1.dateTime=1990-06-15T14:30&person1.timezone=Europe/London&person1.longitude=-0.1278&person1.latitude=51.5074&person2.dateTime=1988-03-22T09:15&person2.timezone=Europe/Paris&person2.longitude=2.3522&person2.latitude=48.8566" \
  -H "X-Api-Key: your-api-key"

Tham số Truy vấn

Tham số Lá số Tử vi

Tham sốBắt buộcMô tả
widthChiều rộng lá số tính bằng pixel
heightChiều cao lá số tính bằng pixel
dateTimeNgày/giờ sinh (YYYY-MM-DDTHH:mm)
location.longitudeKinh độ nơi sinh
location.latitudeVĩ độ nơi sinh
location.timezoneMúi giờ nơi sinh (định dạng IANA)

Tham số Lá số Kết hợp

Tham sốBắt buộcMô tả
widthChiều rộng lá số tính bằng pixel
heightChiều cao lá số tính bằng pixel
person1.dateTimeNgày/giờ sinh của người 1
person1.timezoneMúi giờ của người 1
person1.longitudeKinh độ của người 1
person1.latitudeVĩ độ của người 1
person2.dateTimeNgày/giờ sinh của người 2
person2.timezoneMúi giờ của người 2
person2.longitudeKinh độ của người 2
person2.latitudeVĩ độ của người 2

Header Phản hồi

Các endpoint lá số trả về các loại nội dung phù hợp:

  • SVG: image/svg+xml
  • PNG: image/png

Nhúng Lá số

Sử dụng SVG được trả về trực tiếp trong HTML:

html
<div class="chart-container">
  <!-- Nội dung SVG từ API -->
</div>

Hoặc sử dụng làm nguồn hình ảnh với URL dữ liệu:

html
<img src="data:image/svg+xml;base64,..." alt="Natal Chart" />

Chart2 - Thế hệ Lá số Tiếp theo

AstroAPI cung cấp công cụ hiển thị lá số thế hệ tiếp theo với hỗ trợ giao diện và hoạt ảnh.

Các Endpoint

EndpointMô tảModule Bắt buộc
/api/chart2/natal.svgLá số tử vi (SVG)module:natal-calc
/api/chart2/natal.pngLá số tử vi (PNG)module:natal-calc
/api/chart2/transit.svgLá số hai vòng quá độ (SVG)module:transit-calc
/api/chart2/transit.pngLá số hai vòng quá độ (PNG)module:transit-calc
/api/chart2/synastry.svgLá số hợp tinh (SVG)module:synastry-calc
/api/chart2/synastry.pngLá số hợp tinh (PNG)module:synastry-calc
/api/chart2/composite.svgLá số kết hợp (SVG)module:synastry-calc
/api/chart2/composite.pngLá số kết hợp (PNG)module:synastry-calc
/api/chart2/animated-transit.svgQuá độ hoạt ảnh (SVG)module:transit-calc

Cách Sử dụng Cơ bản

bash
curl -X GET "https://api.astroapi.cloud/api/chart2/natal.svg?width=800&height=800&dateTime=1990-06-15T14:30&location.longitude=4.89&location.latitude=52.37&location.timezone=Europe/Amsterdam&theme=dark" \
  -H "X-Api-Key: your-api-key"

Giao diện Có sẵn

Giao diệnMô tả
defaultNền trắng cổ điển với các yếu tố có màu sắc
classicGiao diện chiêm tinh học truyền thống
darkGiao diện tối hiện đại với màu sắc sống động
minimalGọn gàng, ít nhiễu hình ảnh
colorfulMàu sắc hành tinh sống động
nextgenHiện đại với đường góc chiếu cong, hiệu ứng phát sáng và gradient
vintagePhong cách giấy da/bản thảo cũ với tông màu sepia
neonCyberpunk với màu neon tươi sáng trên nền đen
pastelMàu pastel nhẹ nhàng, bình yên
printTương phản cao đen/trắng, được tối ưu hóa cho in ấn

Ghi đè Giao diện

Tùy chỉnh các thuộc tính giao diện riêng lẻ qua tham số truy vấn:

Tham sốMô tả
theme.backgroundMàu nền (hex)
theme.foregroundMàu tiền cảnh (hex)
theme.strokeOnlyChế độ chỉ viền (true/false)
theme.symbolScaleHệ số tỷ lệ ký hiệu
theme.showDegreesHiển thị nhãn độ (true/false)
theme.showHouseNumbersHiển thị số cung nhà (true/false)
theme.showRulerHiển thị thước đo (true/false)
theme.signBackgroundOpacityĐộ mờ nền cung (0-1)

Lá số Hợp tinh & Kết hợp

bash
curl -X GET "https://api.astroapi.cloud/api/chart2/synastry.svg?width=800&height=800&person1.dateTime=1990-06-15T14:30&person1.timezone=Europe/Amsterdam&person1.longitude=4.89&person1.latitude=52.37&person2.dateTime=1992-03-20T09:15&person2.timezone=Europe/London&person2.longitude=-0.12&person2.latitude=51.50" \
  -H "X-Api-Key: your-api-key"

Quá độ Hoạt ảnh

Tạo SVG hoạt ảnh cho thấy sự tiến triển quá độ theo thời gian:

bash
curl -X GET "https://api.astroapi.cloud/api/chart2/animated-transit.svg?width=800&height=800&dateTime=1990-06-15T14:30&location.longitude=4.89&location.latitude=52.37&location.timezone=Europe/Amsterdam&transit.dateTime=2025-01-01T12:00&transit.timezone=Europe/Amsterdam&target.dateTime=2025-12-31T23:59&animation.duration=3000" \
  -H "X-Api-Key: your-api-key"
Tham sốMô tả
target.dateTimeNgày kết thúc cho hoạt ảnh
animation.durationThời gian hoạt ảnh tính bằng mili giây
animation.easingHàm easing (mặc định: easeInOut)
animation.loopLặp lại hoạt ảnh (mặc định: false)

AstroAPI Documentation