OR博客
【eCharts】eCharts词云图——在Layui中使用
OrdinaryRoad
创建于:2020-12-08 10:25:31
0
17
81
0
echarts功能十分强大,词云图应该也能画,但是官网实例中没找到,在百度里找到了,在这里记录一下。
# 相关链接 [Echarts词云图 - Super~me - 博客园](https://www.cnblogs.com/supershuai/p/12305433.html "Echarts词云图 - Super~me - 博客园") [ecomfe/echarts-wordcloud: Apache ECharts (incubating) wordcloud extension based on wordcloud2.js](https://github.com/ecomfe/echarts-wordcloud "ecomfe/echarts-wordcloud: Apache ECharts (incubating) wordcloud extension based on wordcloud2.js") # 实现过程 1. [下载](https://github.com/ecomfe/echarts-wordcloud "ecomfe/echarts-wordcloud: Apache ECharts (incubating) wordcloud extension based on wordcloud2.js") `echarts-wordcloud.min.js` 2. 粘贴到项目中 3. 修改 `echarts-wordcloud.min.js` 文件以便于在layui中扩展使用 **在文件最后加上以下代码即可** ``` layui.define(function(exports) { exports('echartsWordCloud', echarts); }); ``` 4. 修改 `lay-config.js` ``` layui.config({ base: rootPath + "lay-module/", version: true }).extend({ //... echarts: 'echarts/echarts', // echarts图表扩展 echartsWordCloud: 'echarts/echarts-wordcloud' // echartsWordCloud图表扩展 //... }) ``` 5. 在html文件中使用,跟饼图基本一样,可以参考这篇文章[Echarts词云图 - Super~me - 博客园](https://www.cnblogs.com/supershuai/p/12305433.html "Echarts词云图 - Super~me - 博客园"),还可以自定义词云图形状。 ``` layui.use(['layer', 'echarts', 'echartsWordCloud', 'element', 'table', 'miniTab'], function () { //... }) ```
评论
楼主暂时不想被别人评论哦~