扩展 Shortcode - echarts
echarts
shortcode 使用 ECharts 库提供数据可视化的功能。
ECharts 是一个帮助你生成交互式数据可视化的库。
ECharts 提供了常规的 折线图, 柱状图, 散点图, 饼图, K 线图, 用于统计的 [盒形图][boxplot], 用于地理数据可视化的 地图, 热力图, 线图, 用于关系数据可视化的 关系图, treemap, 旭日图, 多维数据可视化的 平行坐标, 还有用于 BI 的 漏斗图, 仪表盘, 并且支持图与图之间的混搭。
只需在 echarts
shortcode 中以 JSON
/YAML
/TOML
格式插入 ECharts 选项即可。
一个 JSON
格式的 echarts
示例:
|
|
一个 YAML
格式的 echarts
示例:
|
|
一个 TOML
格式的 echarts
示例:
|
|
呈现的输出效果如下:
{"grid":{"bottom":"5%","containLabel":true,"left":"5%","right":"5%","top":"20%"},"legend":{"data":["邮件营销","联盟广告","视频广告","直接访问","搜索引擎"],"top":"10%"},"series":[{"data":[120,132,101,134,90,230,210],"name":"邮件营销","stack":"总量","type":"line"},{"data":[220,182,191,234,290,330,310],"name":"联盟广告","stack":"总量","type":"line"},{"data":[150,232,201,154,190,330,410],"name":"视频广告","stack":"总量","type":"line"},{"data":[320,332,301,334,390,330,320],"name":"直接访问","stack":"总量","type":"line"},{"data":[820,932,901,934,1290,1330,1320],"name":"搜索引擎","stack":"总量","type":"line"}],"title":{"left":"center","text":"折线统计图","top":"2%"},"toolbox":{"feature":{"saveAsImage":{"title":"保存为图片"}}},"tooltip":{"trigger":"axis"},"xAxis":{"boundaryGap":false,"data":["周一","周二","周三","周四","周五","周六","周日"],"type":"category"},"yAxis":{"type":"value"}}echarts
shortcode 还有以下命名参数: