Highcharts 自适应屏幕大小


 最近做项目发现Highcharts无法自适应屏幕大小,看了API发现图表高度是固定的,于是只能调整图表的宽高度

$(function () {
    $(window).resize(function () {
        var windowHeight = 0;
        var widowWidth = 0;
        if (typeof (window.innerHeight) == 'number') {
            windowHeight = window.innerHeight;
            widowWidth = window.innerWidth;
        }
        else {
            if (document.documentElement && document.documentElement.clientHeight) {
                windowHeight = document.documentElement.clientHeight;
                widowWidth = document.documentElement.clientWidth;
            }
            else {
                if (document.body && document.body.clientHeight) {
                    windowHeight = document.body.clientHeight;
                    widowWidth = document.body.clientWidth;
                }
            }
        }

        var width_div = widowWidth / 2 - 20;
        var height_div = windowHeight / 2 - 35;
        $('#u99_img').css("height", height_div);
        $('#u99_img').css("width", width_div);
        $('#u100_img').css("height", height_div);
        $('#u100_img').css("width", width_div);
    });
});

  

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM