在 series中添加
itemStyle : { normal: {label : {show: true}}}
1
在django中使用echarts折线图的完整代码
<script type="text/javascript">
var dom = document.getElementById("container");
var myChart = echarts.init(dom);
var app = {};
option = null;
result = eval({{ chart_data | safe }});
option = {
title: {
text: result.title,
x: 'center',
show : true
},
tooltip: {
formatter: '{b}
{c}'
},
xAxis: {
type: 'category',
data: result.feature
},
yAxis: {
type: 'value'
},
series: [{
data: result.data,
type: 'line',
// 显示数值
itemStyle : { normal: {label : {show: true}}}
}]
};
if (option && typeof option === "object") {
myChart.setOption(option, true);
}
</script>
————————————————