使用swiper loop:true后,slide被克隆导致id不再是唯一,所以echarts的图形出不来;求大神指点迷津!!!万分感谢!!!
使用swiper loop:true后,slide被克隆导致id不再是唯一,所以echarts的图形出不来;求大神指点迷津!!!万分感谢!!!
var myChart2 = echarts.init(document.getElementsByClassName('main-echarts-line-appSysd'));
var option2 = {
//设置标题
// title:{
// text:'应用系统物理表数量',
// subtext:'',
// x:'center'
// },
//设置提示
tooltip: {
show: true
},
grid: {x: '5%', y: '15%'},
//设置坐标轴
xAxis: {
type: 'value',
boundaryGap: [0, 0.01]
},
yAxis: {
show:false,
type: 'category',
data : [],
axisTick: {
alignWithLabel: true
}
},
//设置数据
series : []
};
$.ajax({
type : "get",
url : "${ctx}/app/meta/mgr/getAppSysTableCount.do",
cache : true,
async : true,
dataType : "json",
success : function(data) {
if(data){
var yAxis_dataList = [];
var bar_dataList = [];
for(var item in data){
if(typeof(data[item])== "function")
continue;
yAxis_dataList.push(item);
bar_dataList.push(data[item]);
//console.log("data中"+item+"的值="+data[item]);
}
option2.yAxis.data = yAxis_dataList;
option2.series = [{
name:"数量",
type:"bar",
data:bar_dataList,
//设置柱的宽度
"barWidth":"65%",
itemStyle: {
normal: {
//设置柱状不同颜色,
color: function(params) {
// build a color map as your need.
var colorList = [
'#6495ed','#ff7f50','#87cefa','#ffb980','#468cf5',
'#86a2de','#31d976','#FAD860','#F3A43B','#60C0DD',
'#D7504B','#C6E579','#F4E001','#F0805A','#C1232B'
];
return colorList[params.dataIndex]
},
//以下为是否显示,显示位置和显示格式的设置了
label: {
show: true,
position: 'insideLeft',
formatter: '{b}[{c}]',
textStyle: {
color: '#333',
fontWeight: 'bold',
fontSize: 11
}
}
}
},
}];
// 为echarts对象加载数据
myChart2.setOption(option2);
}
}
});
这是我的代码!!!然后报错:this.dom.getContext is not a function
13 回答12.9k 阅读
7 回答2.1k 阅读
3 回答1.3k 阅读✓ 已解决
2 回答1.3k 阅读✓ 已解决
6 回答1.2k 阅读✓ 已解决
6 回答1.1k 阅读
3 回答1.3k 阅读✓ 已解决
8 回答15.8k 阅读✓ 已解决
1 回答4.7k 阅读
1 回答4.7k 阅读✓ 已解决
1 回答2.6k 阅读✓ 已解决
1 回答14k 阅读
你用class选择器不就行了吗