echarts + php 页面多统计图屏幕自适应

来源:互联网 发布:php解密专家 编辑:程序博客网 时间:2024/06/06 05:55
var myStyle= echarts.init(document.getElementById("xiaosell"));myStyle.setOption({    title:{},    tooltip:{        trigger: 'axis'    },    legend:{        //data:['营收']    },    grid: {        top:'11%',        left: '1%',        right: '2%',        bottom: '2%',        containLabel: true    },    toolbox: {//        下载图片//        feature: {//            saveAsImage: {}//        }    },    xAxis: {        type: 'category',        boundaryGap: false,        data: ['1月份','2月份','3月份','4月份','5月份','6月份','7月份','8月份','9月份','10月份','11月份','12月份']    },    yAxis: {        type: 'value',        axisLabel:{            formatter:'{value} k'        },        boundaryGap: false  //边界的间隙    },    series: [        {            name:'营收',            type:'line',            legendHoverLink : false,//禁止高亮            itemStyle:{                normal:{                    color:'#0F88EB',                    textStyle : {                        label : {                            color:'#0F88EB'                        }                    },                    lineStyle:{                        color:'#0F88EB',                        width:1                    }                }            },            data:['12', '13', '17', '14', '19', '20', '21','12','24','23','24','23']        }]});
使用window.onresize = option.chart.resize()  不行,单个可以,下面的可以
 window.addEventListener("resize", function () {     //添加一个监听
                      option.chart.resize();
                  });
window.addEventListener("resize", function () {    setTimeout("myStyle.resize()",100);});
阅读全文
0 0