echart freemarker 模板_SpringBoot集成Freemarker模板生成Echarts图片(三)

本文介绍了如何在SpringBoot项目中利用Freemarker模板生成Echarts图表图片,包括柱状图、渐变色柱状图、折线图和饼图的配置和示例数据。此外,还提供了环境配置说明和测试效果。
摘要由CSDN通过智能技术生成

紧接着前面两篇,本篇采用Freemarker模板来生成Echarts图片。

一. 项目结构

二. Freemarker模板

(1)柱状图

{

"title": {

"text": "${title}",

"textStyle": {

"color": "red",

"fontSize": 15,

"fontWeight": "bolder"

}

},

"tooltip": {

"formatter": "{a}
{b} : {c}",

"show": true

},

"legend": {

"textStyle": {

"color": "red",

"fontSize": 15,

"fontWeight": "bolder"

},

"data": ["${legend}"]

},

"xAxis": [{

"type": "category",

"axisLabel": {

"show": true,

"textStyle": {

"fontSize": 15,

"fontWeight": "bolder"

}

},

"axisLine":{

"lineStyle":{

"color": "#315070",

"width":4

}

},

"data": ${category}

}],

"yAxis": [{

"type": "value",

"axisLabel": {

"show": true,

"textStyle": {

"fontSize": 15,

"fontWeight": "bolder"

}

},

"axisLine":{

"lineStyle":{

"color":"#315070",

"width":4

}

}

}],

"series": [{

"name": "${legend}",

"data": ${values},

"type": "bar",

"label": {

"normal": {

"color": "green",

"fontSize": 15,

"fontWeight": "bolder",

"show": true,

"position": "top"

}

}

}]

}

(2)渐变色柱状图

{

"title": {

"text": "${title}",

"textStyle": {

"color": "red",

"fontSize": 15,

"fontWeight": "bolder"

}

},

"toolbox": {

"feature": {},

"show": true

},

"tooltip": {

"formatter": "{a}
{b} : {c}",

"show": true

},

"legend": {

"textStyle": {

"color": "red",

"fontSize": 15,

"fontWeight": "bolder"

},

"data": ["${legend}"]

},

"xAxis": [{

"type": "category",

"axisLabel": {

"show": true,

"textStyle": {

"fontSize": 15,

"fontWeight": "bolder"

}

},

"axisLine":{

"lineStyle":{

"color":'#315070',

"width":4

}

},

"data": ${category}

}],

"yAxis": [{

"type": "value",

"axisLabel": {

"show": true,

"textStyle": {

"fontSize":

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值