使用echart遇到的坑
1.解决echarts出现console未定义异常
if (!window.console || !console.firebug){
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i)
window.console[names[i]] = function() {}
}
2.echart 图标 重新加载变大
是因为echart中的canvas重新加载了 ,详情参考 https://www.jb51.net/article/128795.htm
直接给echart赋值就可以。自适应
chart = document.getElementById("staChart");
chart.style.width = $(window).width()*0.45+'px';
chart.style.height = $(window).height()*0.3+'px';
var myChart = echarts.init(chart);
myChart.setOption(getChartOption());
3.echart tooltip 提示框抖动
先考虑下去换下js,换个高版本的。也可以加个延时,虽然还抖动,但是效果不是那么明显 ,showDelay:200