echartfreemarker模板_SpringBoot集成Freemarker模板⽣
成。。。
紧接着前⾯两篇,本篇采⽤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,
"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": {
"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": 15, "fontWeight": "bolder" }
},
"axisLine":{ "show":true, "lineStyle":{ "color":'#315070', "width":4
},
"axisTick": {
"show": true
}
}],
"series": [{
"name": "${legend}", "type": "bar",
"label": {
"normal": {
"color": "red", "fontSize": 15, "fontWeight": "bolder", "show": true, "position": "top"
}fontweight取值
},
"data":${values}, "itemStyle": "__itemStyle" }]
}
(3)折线图
{
"title": {
"text": "${title}", "subtext": "", "textStyle": {
"color": "red", "fontSize": 15, "fontWeight": "bolder" },
"x": "left"
},
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论