单盘接口通用参数说明
本文档说明所有单盘接口(/onechart)的通用参数,包括动态天体配置、恒星、阿拉伯点、分析、容许度、SVG绘图等参数。
接口说明
本接口提供完整的星盘计算和分析功能,包括:
- 动态天体配置:支持多级配置和自定义天体组合,包括减法语法
- 基础数据:行星位置、宫位、特殊点(ASC、MC等)
- 恒星计算:支持多种恒星选择方案(4-191颗恒星),可计算恒星位置和相位
- 阿拉伯点:支持计算各种阿拉伯点,使用AP编号系统
- 小行星支持:支持谷神星、智神星、婚神星、灶神星等小行星
- 特殊点计算:支持日月食点、朔望点等特殊天体
- 相位分析:行星相位、恒星相位,支持多种相位方案和自定义容许度
- 详细分析:行星星座、宫位、元素分布、性质分析等
- SVG绘图:三种风格的星盘图(标准、经典、GD),支持主题和自定义显示
动态天体配置参数
| 参数名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| dynamic_planet_config | object | null | 动态天体配置对象,包含以下子参数:
|
配置级别说明
"basic": 传统占星(主要行星+北交点)"modern_standard": 现代标准(基础+凯龙+莉莉丝)"modern_complete": 现代完整(标准+小行星+真交点)"research": 研究级(完整+汉堡学派)"complete": 完整配置(所有支持的天体)"custom": 自定义配置(需配合custom_*参数)
减法语法
支持 ["default", "-PLUTO", "-URANUS"] 从默认配置中移除特定天体
完全自定义
直接指定天体列表 ["SUN", "MOON", "MERCURY"]
小行星编号
使用SwissEph ID,如 17=CERES, 19=JUNO
恒星参数
| 参数名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| include_fixed_star | string/array/boolean | false | 恒星选择方案:
|
| fixed_stars_in_svg | string/array | null | SVG中显示的恒星:
|
阿拉伯点参数
注意:阿拉伯点配置已整合到动态天体配置中
推荐使用 dynamic_planet_config.custom_arabic_parts 参数,以下参数保留用于向后兼容:
| 参数名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| custom_arabic_parts | string/array/boolean | false | 阿拉伯点选择(向后兼容):
|
| arabic_parts_in_svg | string | null | SVG中显示的阿拉伯点:"all" 或 null |
常用AP编号:AP0001=福点, AP0002=隐形点, AP0003=精神点, AP0004=爱情点, AP0005=婚姻点, AP0006=死亡点, AP0007=父亲点, AP0008=母亲点, AP0009=子女点
分析参数
| 参数名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| include_analysis | boolean | false | 是否包含详细分析数据(行星星座、宫位、相位等)。传 true 时会返回 analysis 相关字段,并且会自动附加对应解释语料(仅使用 aixingpan 语料集,且按当前 chart_type 过滤)。 |
| include_traditional | boolean | false | 是否返回传统技法数据(映点/中点树/光线传递/光线围攻/宫位围攻/宫头Almuten/盘之主宰/特殊度数/行星链)。传 true 时返回 data.traditional 字段 |
| include_lots | boolean | false | true 时返回 lots 数组:ZR 九专项点(福点/精神点/爱欲点/困顿点/勇气点/胜利点/仇敌点/根基点/子女点)的黄经、星座与整宫宫位(Lot 落点按 Paulus 日/夜公式由 ASC 与行星推算) |
| traditional_techniques | array | null | 要计算的传统技法子集,如 ["mirror_points", "midpoint_analysis"];不传时默认计算全部 9 项。可选值含 light_collection(光线收集) |
| aspects_to_calculate | array | null | 要计算的相位列表,如:["conjunction", "opposition", "trine", "square", "sextile"] |
| aspect_scheme | string | null | 相位方案:
|
| house_ruler_system | string | "traditional" | 宫主星系统:"traditional"(古典)或 "modern"(现代) |
| include_fixed_star_aspects | boolean | true | 是否在相位计算中包含恒星 |
容许度参数
| 参数名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| orb_scheme | string | "default" | 容许度计算方法:
|
| custom_orbs | object | null | 自定义容许度(部分覆盖),包含三个子对象:
|
相位和容许度配置说明
- 自动配置:每种星盘类型有默认的相位方案和容许度配置,无需手动指定
- 部分自定义:使用 custom_orbs 可以只修改部分容许度
- 完全自定义:使用 aspects_to_calculate 可以指定要计算的相位列表
traditional 传统技法字段说明
请求带 include_traditional: true 时,data.traditional 返回:
| 字段 | 类型 | 说明 |
|---|---|---|
| items | array | 本次计算的技法列表 |
| results | object | 各技法的结果,键为技法名 |
| errors | object | 计算失败的技法及原因(如全部成功则无此字段) |
results 下 9 个技法名与内容:
| 技法名 | 内容 |
|---|---|
| mirror_points | 映点:contacts 各行星的映点接触(含 mirror_longitude 数值黄经与 mirror_position 文本位置),mirror_positions 各行星映点黄经表 |
| midpoint_analysis | 中点:midpoints 各行星对的中点(pair 数组 + midpoint_longitude 数值 + position 文本),activations 被行星触发的中点(structure/aspect/orb) |
| light_collection | 光线收集:collector 收集星、principal_a/principal_b 两主星、a_aspect/b_aspect 各自相位、a_days_to_exact/b_days_to_exact 各自完美天数(两主星同时入相同一颗更重的收集星) |
| light_transfer | 光线传递:carrier 传递星、from_planet/to_planet 两侧、相位与容许度、days_to_exact |
| light_besiegement | 光线围攻:target 被围攻行星、by 围攻方、mode(zodiacal/aspect) |
| house_besiegement | 宫位围攻:target、house、adjacent_houses、by |
| cuspal_almutens | 12 宫头 Almuten:house、cusp_longitude、almuten、score、score_detail 计分明细 |
| chart_almuten | 盘之主宰:almuten 结论、ranking 计分排行、details 明细(at/at_longitude/holder/dignities/points) |
| degree_highlights | 特殊度数:planet、longitude 数值、position 文本、tags(临界度/初始度/完结度) |
| longitude_sequence | 行星链:sequence(planet/longitude/position/preceded_by/followed_by)、leading_edge、trailing_edge |
- 行星名全大写(SUN/MOON/MERCURY...),与 onechart 一致
- 位置同时给出数值黄经(longitude 字段)与中文文本(position 字段,格式"星座 度°分′")
- 本参数适用于所有星盘类型;不传时返回体不含 traditional 字段
相位 movement 字段说明
data.analysis.aspects 数组中每个相位都包含 movement 字段:
| 取值 | 含义 |
|---|---|
| applying | 入相:两行星角距正在逼近该相位的精确角 |
| separating | 出相:两行星角距已越过精确角并在拉远 |
- 接口不返回 exact。是否精确由前端自行判断:
|aspect_orb|接近 0(如 ≤ 0.1°)即为精确相位 - 该判断基于两行星的实际速度推演,逆行行星也会被正确处理
- 适用于所有星盘类型的
analysis.aspects(含双盘 /trichart 的相位)
SVG绘图参数
| 参数名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| include_svg | boolean | true | 是否生成SVG图 |
| include_svg_coords | boolean | false | 是否在返回数据中嵌入SVG坐标。传 true 时,data.svg_coords 中会包含所有可交互元素的像素坐标:
注意:需要同时设置 include_svg=true
|
| include_coordinates | boolean | false | 是否返回坐标数据,用于前端交互。传 true 时返回 coordinates 字段,包含所有可点击元素的坐标位置 |
| chart_style | string | "standard" | 星盘风格:
|
| display_planets | array | null | SVG中显示的行星列表,如:["SUN", "MOON", "MERCURY"] |
| display_aspects | array | null | SVG中显示的相位列表,如:["conjunction", "opposition", "trine"] |
| use_chinese_font | boolean | false | 是否使用中文占星符号字体(12signcn) |
| theme | string | "light" | 主题,影响SVG的整体颜色和样式:
|
| minimal_svg | boolean | false | 极简SVG模式。传 true 时:
true 时会自动强制使用 "minimal" 主题,覆盖 theme 参数。
|
| custom_colors | object | null | 自定义颜色对象,用于覆盖主题颜色。可设置的键:
"#RRGGBB",如 "#ff0000"
|
| custom_config | object | null | 自定义配置对象,用于覆盖绘制配置。可设置的键:
|
| svg_radius_config | object | null | 半径配置对象,用于自定义星盘各圆环的大小。包含以下子参数:
|
svg_radius_config 说明
设计原则:只需传需要修改的倍数,未传的项保持默认值。
base_radius(具体像素值)控制整体大小,其他所有圆环均通过倍数相对于 base_radius 计算。
standard 风格可用倍数键
| 键名 | 默认倍数 | 说明 |
|---|---|---|
| zodiac_outer | 1.0 | 黄道带外圈 |
| zodiac_inner | 0.9 | 黄道带内圈 |
| house_outer | 0.9 | 宫位外圈 |
| house_inner | 0.8 | 宫位内圈 |
| planet_inner | 0.6 | 行星相位连接点(内) |
| planet_outer | 0.65 | 行星相位连接点(外) |
| planet_symbol | 0.7 | 行星符号圈 |
| asteroid_label | 0.75 | 小行星标签圈 |
| bi_outer_planet_symbol | 0.7 | 双盘外圈行星符号 |
| bi_outer_planet_dot | 0.57 | 双盘外圈行星点 |
| bi_inner_planet_symbol | 0.62 | 双盘内圈行星符号 |
| bi_inner_planet_dot | 0.57 | 双盘内圈行星点 |
| bi_aspect | 0.52 | 双盘相位线圈 |
| bi_inner_label | 0.65 | 双盘内圈标签 |
| bi_outer_label | 0.75 | 双盘外圈标签 |
| trichart_house_outer | 0.2 | 三盘宫位外圈 |
| trichart_house_inner | 0.13 | 三盘宫位内圈 |
| trichart_inner_planet_symbol | 0.40 | 三盘内圈行星符号 |
| trichart_inner_planet_dot | 0.35 | 三盘内圈行星点 |
| trichart_middle_planet_symbol | 0.6 | 三盘中圈行星符号 |
| trichart_middle_planet_dot | 0.55 | 三盘中圈行星点 |
| trichart_outer_planet_symbol | 0.8 | 三盘外圈行星符号 |
| trichart_outer_planet_dot | 0.75 | 三盘外圈行星点 |
| trichart_aspect | 0.60 | 三盘相位线圈 |
| tri_ring2_planet_outer | 0.63 | 三盘Ring2行星位置点 |
| tri_ring2_planet_symbol | 0.67 | 三盘Ring2行星符号 |
| tri_ring3_planet_outer | 0.88 | 三盘Ring3行星位置点 |
| tri_ring3_planet_symbol | 0.92 | 三盘Ring3行星符号 |
gd 风格额外可用倍数键
| 键名 | 默认倍数 | 说明 |
|---|---|---|
| degree | 0.74 | 度数圈 |
| zodiac_sign | 0.7 | 星座符号圈 |
| minute | 0.65 | 分数圈 |
| retrograde | 0.6 | 逆行符号圈 |
| bi_house_outer | 0.28 | GD双盘宫位外圈 |
| bi_house_inner | 0.20 | GD双盘宫位内圈 |
| bi_middle_circle | 0.60 | GD双盘中间分隔圈 |
| trichart_gd_house_outer | 0.20 | 三盘GD宫位外圈 |
| trichart_gd_house_inner | 0.15 | 三盘GD宫位内圈 |
| trichart_gd_radius_increment | 0.05 | 三盘GD等比递增量 |
| trichart_gd_inner_retrograde | 0.20 | 三盘GD内圈逆行基准 |
| trichart_gd_middle_retrograde | 0.42 | 三盘GD中圈逆行基准 |
| trichart_gd_outer_retrograde | 0.64 | 三盘GD外圈逆行基准 |
| trichart_gd_aspect | 0.15 | 三盘GD相位线 |
| asteroid_label | 0.84 | 小行星标签圈 |
使用示例
// 只修改 base_radius(整体缩放)
"svg_radius_config": {
"base_radius": 300
}
// 只修改部分倍数(其他保持默认)
"svg_radius_config": {
"base_radius": 400,
"radius_factors": {
"zodiac_inner": 0.88,
"planet_symbol": 0.72
}
}
// 仅修改双盘行星位置
"svg_radius_config": {
"radius_factors": {
"bi_outer_planet_symbol": 0.80,
"bi_inner_planet_symbol": 0.65
}
}
其他参数
| 参数名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| house_system | string | "P" | 宫位系统:
|
请求示例
示例1:使用动态天体配置
{
"chart_type": "transit",
"data": {
"datetime": "1990-06-15 14:30:00",
"lat": 39.9042,
"lon": 116.4074,
"tz": 8
},
"dynamic_planet_config": {
"level": "custom",
"custom_planets": ["default", "-PLUTO", "-URANUS"],
"custom_asteroids": [17],
"custom_arabic_parts": ["AP0001", "AP0002"]
},
"include_fixed_star": "default",
"fixed_stars_in_svg": "conjunct",
"include_analysis": true,
"include_svg": true
}
示例2:完整配置(所有参数)
{
"chart_type": "natal",
"data": {
"datetime": "1990-01-01 12:00:00",
"lat": 39.9042,
"lon": 116.4074,
"tz": 8
},
"house_system": "P",
"dynamic_planet_config": {
"level": "modern_complete",
"custom_arabic_parts": ["AP0001", "AP0002", "AP0004", "AP0005"]
},
"include_fixed_star": "default",
"fixed_stars_in_svg": ["conjunction", "opposition"],
"include_analysis": true,
"aspect_scheme": "transit",
"house_ruler_system": "modern",
"include_fixed_star_aspects": true,
"orb_scheme": "default",
"custom_orbs": {
"aspects": {
"conjunction": 8.0,
"opposition": 8.0,
"trine": 6.0,
"square": 6.0,
"sextile": 4.0
},
"planets": {
"SUN": 1.5,
"MOON": 1.5
},
"fixed_stars": {
"magnitude_1": 6.0,
"magnitude_2": 5.0
}
},
"include_svg": true,
"chart_style": "standard",
"display_aspects": ["conjunction", "opposition", "trine", "square", "sextile"],
"use_chinese_font": false,
"theme": "light"
}
示例3:完整阿拉伯点配置
{
"chart_type": "natal",
"data": {
"datetime": "1990-01-01 12:00:00",
"lat": 39.9042,
"lon": 116.4074,
"tz": 8
},
"dynamic_planet_config": {
"level": "modern_standard",
"custom_arabic_parts": [
"AP0001", "AP0002", "AP0003", "AP0004", "AP0005",
"AP0006", "AP0007", "AP0008", "AP0009", "AP0100"
]
},
"include_fixed_star": "essential",
"include_analysis": true,
"include_svg": true,
"chart_style": "standard"
}
说明:使用现代标准行星配置 + 10个常用阿拉伯点 + 核心恒星,适合详细分析。
示例4:极简SVG(不嵌入字体,无颜色,前端动态渲染)
{
"chart_type": "natal",
"data": {
"datetime": "1990-01-01 12:00:00",
"lat": 39.9042,
"lon": 116.4074,
"tz": 8
},
"include_svg": true,
"minimal_svg": true
}
说明:返回的SVG不包含嵌入字体和颜色填充,文字使用系统sans-serif字体,所有fill属性为none,stroke为黑色。 前端可通过JS动态设置颜色和加载自定义字体,适合需要动态切换样式的场景。SVG体积从约38KB降至约14KB。
示例5:自定义颜色和字体大小
{
"chart_type": "natal",
"data": {
"datetime": "1990-01-01 12:00:00",
"lat": 39.9042,
"lon": 116.4074,
"tz": 8
},
"include_svg": true,
"theme": "light",
"use_chinese_font": true,
"custom_colors": {
"line_color": "#ff0000",
"zodiac_ring_fill": "#00ff00",
"axis_line_color": "#0000ff"
},
"custom_config": {
"zodiac_font_size": 40,
"chinese_zodiac_font_size": 36,
"planet_size": 40,
"chinese_planet_size": 28,
"house_number_font_size": 18,
"chinese_house_number_font_size": 16
},
"svg_radius_config": {
"base_radius": 350,
"radius_factors": {
"zodiac_inner": 0.85,
"planet_symbol": 0.65
}
}
}
说明:使用中文占星符号字体,自定义颜色覆盖主题颜色,自定义字体大小覆盖默认值,自定义半径倍数调整星盘布局。
注意事项
- 动态天体配置:推荐使用 dynamic_planet_config 参数进行天体配置,支持减法语法和完全自定义
- 恒星计算:恒星通过 include_fixed_star 参数计算,支持多种预设方案和自定义列表
- 阿拉伯点:阿拉伯点会同时出现在 arabic_parts 和 planets 数据中,便于统一处理
- 阿拉伯点编号系统:使用AP编号(如AP0001=福点, AP0004=爱情点, AP0005=婚姻点),系统支持400+个阿拉伯点
- SVG显示控制:fixed_stars_in_svg 控制SVG中显示哪些恒星,智能默认为只显示有合相的恒星
- 相位计算:即使 include_analysis=false,如果请求了SVG,相位也会被计算用于绘图
- 容许度方案:
- default: 相位容许度 + 行星容许度之和
- xingguang: 星光容许度(行星容许度的平均值)
- 向后兼容:支持旧的参数格式,如 custom_aspect_orbs 会自动转换为 custom_orbs.aspects
- 数据过滤:返回的JSON数据会根据动态配置自动过滤,确保与SVG显示一致
- 性能考虑:计算恒星、阿拉伯点和详细分析会增加计算时间,按需使用
- 主题支持:支持多种主题(light, dark, classic等),影响SVG的颜色和样式
- 交互式接口:除了标准的 /onechart 接口,还提供 /onechart_interactive 接口,返回额外的坐标数据用于前端交互
返回数据结构说明
坐标数据结构(include_coordinates=true时返回)
当 include_coordinates 参数为 true 时,返回数据中会包含 coordinates 字段,提供所有可交互元素的坐标位置:
{
"coordinates": {
"svg_config": {
"width": 800,
"height": 800,
"center_x": 400,
"center_y": 400,
"asc_longitude": 285.5
},
"planets": [
{
"name": "SUN",
"type": "planet",
"longitude": 280.5,
"z_x": 400,
"z_y": 200,
"sign": "Capricorn",
"house": 10
},
{
"name": "FORTUNA",
"type": "arabic_part",
"longitude": 150.2,
"z_x": 550,
"z_y": 300
},
{
"name": "ALDEBARAN",
"type": "fixed_star",
"longitude": 69.5,
"z_x": 600,
"z_y": 350
}
],
"houses": [
{"number": 1, "z_x": 420, "z_y": 420},
{"number": 2, "z_x": 380, "z_y": 450}
],
"signs": [
{"name": "Aries", "index": 0, "z_x": 460, "z_y": 460},
{"name": "Taurus", "index": 1, "z_x": 520, "z_y": 520}
]
}
}
| 字段 | 类型 | 说明 |
|---|---|---|
| svg_config | object | SVG画布配置信息 |
| planets | array | 所有天体坐标(行星、阿拉伯点、恒星等),通过 type 字段区分类型:
|
| houses | array | 12个宫位数字的坐标位置(宫位数字显示的中心点) |
| signs | array | 12个星座符号的坐标位置 |
坐标说明
- z_x, z_y:统一的坐标字段名,表示元素在SVG中的位置
- 坐标系:以SVG左上角为原点(0,0),向右为x正方向,向下为y正方向
- 相位坐标:不单独返回相位坐标,前端可通过行星坐标自行计算相位线
- 中点计算:相位线中点可通过
(planet1.z_x + planet2.z_x) / 2计算
通用数据结构
- analysis.config:包含本次计算使用的全局配置(orb_scheme, aspect_scheme, fixed_star_orb_scheme)
- 相位数据简化:每个相位不再包含 orb_scheme 和 involves_fixed_star 字段,减少冗余
- 恒星相位识别:通过 planet1 或 planet2 的名称即可判断是否为恒星相位
各星盘类型特点
- 本命盘特点:个人出生时刻的星体位置图,是占星学分析的基础
- 行运盘特点:行运盘接口用于计算指定时刻的实际天象,是占星预测中最基础和重要的技术之一
- 月亮返照盘特点:月亮返照盘接口用于计算月亮回到本命盘相同位置时的星盘,用于分析月度情感和内在状态
- 太阳返照盘特点:太阳返照盘接口用于计算太阳回到本命盘相同位置时的星盘,用于分析年度运势和主题
- 太阳弧推运盘特点:太阳弧推运盘接口用于计算基于太阳弧度的推运星盘,用于预测未来事件
- 次限推运盘特点:次限推运盘接口用于计算次限推运星盘,用于分析长期发展趋势
- 三限推运盘特点:三限推运盘接口用于计算三限推运星盘,用于分析短期发展趋势
- 组合盘特点:组合盘接口用于计算两人关系的组合星盘,用于分析关系动态和互动模式
- 戴维森盘特点:戴维森盘接口用于计算两人关系的戴维森关系盘,用于分析关系的深层结构
- 马克思盘特点:马克思盘接口用于计算两人关系的马克思关系盘,用于分析关系中的心理感受