各位网友:
目前我在使用java(普通的servlet模式),ajax,echarts画双折线图的时候遇到问题谷歌浏览器报错:Uncaught Error: yAxis "0" not found,查了好久一直都没能解决,所以向大家求助。
已知后台可以查询出来数据无异常,然后servler将对象转为json格式响应给前端。以下是主要代码:
//前端代码
首页var main = document.getElementById('main');
var myChart = echarts.init(main);
var colors = ['#5793f3', '#d14a61', '#675bba'];
var setOption = {
color: colors,
tooltip: {
trigger: 'none',
axisPointer: {
type: 'cross'
}
},
legend: {
data:['2015 降水量', '2016 降水量']
},
grid: {
top: 70,
bottom: 50
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
axisLine: {
onZero: false,
lineStyle: {
color: colors[1]
}
},
axisPointer: {
label: {
formatter: function (params) {
return '降水量 ' + params.value + ':'