import json
def main():
echarts_config = {
"title": {
"left": "center",
"text": "分布情况"
},
"tooltip": {
"trigger": "axis",
"axisPointer": {
"type": "cross"
}
},
"grid": {
"bottom": "80px",
"left": "50px",
"right": "50px",
"top": "60px",
"containLabel": True
},
"legend": {
"show": True,
"top": "10%"
},
"xAxis": {
"type": "category",
"data": [
"2026-01-10",
"2026-01-11",
"2026-01-12"
],
"axisLabel": {
"rotate": 30,
"interval": 0
}
},
"yAxis": {
"type": "value"
},
"color": [
"#5470c6"
],
"series": [
{
"data": [
3,
1,
12,
],
"type": "line",
"smooth": True,
"name": "分布情况",
"symbol": "circle",
"symbolSize": 6,
"lineStyle": {
"width": 3
}
}
],
"dataZoom": [
{
"type": "slider",
"xAxisIndex": 0,
"show": True,
"height": 15,
"bottom": 25,
"fillerColor": "rgba(135,206,250,0.2)",
"borderColor": "#ccc"
}
],
"toolbox": {
"show": True,
"feature": {
"dataView": {
"show": True,
"title": "数据视图",
"readOnly": False
},
"magicType": {
"show": True,
"type": [
"line",
"bar"
],
"title": {
"line": "折线图",
"bar": "柱状图"
},
"option": {
"series": {
"smooth": True,
"symbol": "circle",
"symbolSize": 6,
"lineStyle": {
"width": 3
}
}
}
},
"restore": {
"show": True,
"title": "还原"
},
"saveAsImage": {
"show": True,
"title": "保存图片"
}
}
}
}
return {
"result": "```echarts\n" + json.dumps(echarts_config, ensure_ascii=False) + "\n```"
}
例行检查
功能描述
已知平台支持通过
echart的json代码的渲染展示,支持toolbox的saveAsImage导出图片功能。但似乎dataView数据视图、magicType类型切换和restore还原的功能并不支持。应用场景
增强交互性
相关示例
期待示例:
实际示例:
代码如下: