写了一个echarts,再刷新图形的时候,发现x轴不变,经过多方查找发现问题,如下:
开始的时候我的写法如下,
var myChart2 = echarts.init(document.getElementById("charts2"), 'shine');
option2 = {
tooltip : {
trigger: 'axis'
},
legend: {
data:['用户数','设备数'],
// data:[],
y:"bottom"
},
grid: {
top: '2%',
left: '2%', //图表距边框的距离
right: '2%',
bottom: '4%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: ['7-1','7-2','7-3','7-4','7-5','7-5','7-6','7-7','7-8','7-9','7-10','7-11','7-12','7-13'],
//x轴文字旋转
axisLabel:{
rotate:30,
interval:0
}
}
],
yAxis : [
{