'commit'
This commit is contained in:
@@ -25,15 +25,15 @@ c = (
|
||||
)
|
||||
)
|
||||
|
||||
# 获取图表的选项配置
|
||||
options = c.get_options()
|
||||
# 获取图表的选项配置,使用 dump_options_with_quotes 方法获取可以直接序列化的选项
|
||||
options_str = c.dump_options_with_quotes()
|
||||
|
||||
# 将选项转换为 JSON 字符串
|
||||
json_str = json.dumps(options, indent=2, ensure_ascii=False)
|
||||
# 输出选项字符串
|
||||
print(options_str)
|
||||
|
||||
# 输出 JSON 字符串
|
||||
print(json_str)
|
||||
|
||||
# 可选:将 JSON 保存到文件
|
||||
# 可选:将选项保存到文件
|
||||
with open("bar_chart_config.json", "w", encoding="utf-8") as f:
|
||||
f.write(json_str).render("bar_markline_custom.html"))
|
||||
f.write(options_str)
|
||||
|
||||
# 如果需要同时生成 HTML 文件,取消下面这行的注释
|
||||
# c.render("bar_markline_custom.html")
|
||||
|
Reference in New Issue
Block a user