用途:编辑定义 OWID Grapher 图表配置的 .chart.yml 文件并预览效果。适用于修改图表配置、调整外观、处理 graph 步骤等场景。
文件位置:图表配置位于 etl/steps/graph/<namespace>/<version>/<short_name>.chart.yml;schema 为 schemas/chart-schema.json;DAG 定义在 dag/graph/<namespace>.yml。
编辑前应先读 schema 了解合法字段、枚举与嵌套结构,读目标 .chart.yml 了解当前配置,并查看 DAG 确认图表依赖的数据集。
配置有两种格式:简单格式(单个指标,使用 dimensions[].property 与 dimensions[].catalogPath);多维格式(下拉选择多个指标组合,title 为对象,dimensions 定义 UI 分面,真实指标在 views[].indicators.y[].catalogPath)。
预览:通过暂存服务器,URL 形如 http://staging-site-{branch}/grapher/{slug},PNG 为 http://staging-site-{branch}/grapher/{slug}.png?nocache,可加 &tab=map 或 &tab=chart。前提是图表已推送到暂存;若无 VSCode 预览扩展自动推送,手动执行 .venv/bin/etlr graph://<namespace>/<version>/<slug> --graph --graph-push --private。
流程:读图表与 schema → 编辑 → 推送到暂存 → 抓取 PNG 视觉核对 → 如有问题查 schema 修正。
常见编辑:改默认标签页(tab 可选 chart、map、table、line、slope、discrete-bar、marimekko);改选中实体(selectedEntityNames);改颜色(map.colorScale.customCategoryColors 或 colorScale.customCategoryColors);改配色方案(baseColorScheme);显示/隐藏地图标签页(hasMapTab);添加备注(note);改坐标轴(yAxis/xAxis 的 min、max、scaleType、label)。
校验:需符合 schemas/chart-schema.json,key 约束包括 tab 与 chartTypes 枚举、dimensions[].property 取 y/x/size/color/table、addCountryMode 取 add-country/change-country/disabled。
限制:资料未提供更多平台支持、权限或价格信息;具体字段取值以 schema 为准。