真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

H5跨平臺(tái)開發(fā)app之橫豎屏導(dǎo)致的圖表混亂問題-創(chuàng)新互聯(lián)

在跨平臺(tái)開發(fā)中,猶豫使用的是非原生開發(fā)語言,會(huì)導(dǎo)致很多不方便的地方,最近公司做一個(gè)統(tǒng)計(jì)圖表的東西,如果用原生開發(fā)的話比較容易控制圖表顯示時(shí)手機(jī)屏幕的方向,在跨平臺(tái)開發(fā)中比較麻煩,

創(chuàng)新互聯(lián)的客戶來自各行各業(yè),為了共同目標(biāo),我們?cè)诠ぷ魃厦芮信浜?,從?chuàng)業(yè)型小企業(yè)到企事業(yè)單位,感謝他們對(duì)我們的要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團(tuán)隊(duì)有機(jī)會(huì)用頭腦與智慧不斷的給客戶帶來驚喜。專業(yè)領(lǐng)域包括成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、電商網(wǎng)站開發(fā)、微信營(yíng)銷、系統(tǒng)平臺(tái)開發(fā)。

如果用戶打開了手機(jī)屏幕自動(dòng)旋轉(zhuǎn),有可能導(dǎo)致圖表顯示的錯(cuò)誤。

解決方案:





    
        
        ichartjs designer
        
        
        
            var evt = "onorientationchange" in window ? "orientationchange" : "resize";

            window.addEventListener(evt, function() {
                console.log(evt);
                var width = document.documentElement.clientWidth;
                var height = document.documentElement.clientHeight;
                $print = $('#ichart-render');
                if(width > height) {
                    $print.width(width);
                    $print.height(height);
                    $print.css('top', 0);
                    $print.css('left', 0);
                    $print.css('transform', 'none');
                    $print.css('transform-origin', '50% 50%');
                    //這里取得了圖表顯示控件后要對(duì)其進(jìn)行設(shè)置CSS,否則來回旋轉(zhuǎn)將導(dǎo)致布局錯(cuò)誤
                    var x = document.getElementById("ichart-render");
                    x.style.position = "absolute";
                    x.style.top = "20%";
                } else {
                    $print.width(height);
                    $print.height(width);
                    $print.css('top', 0);
                    $print.css('left', 0);
                    $print.css('transform', 'none');
                    $print.css('transform-origin', '50% 50%');
                }

            }, false);
        
        
            var w = document.documentElement.clientWidth;
            var h = document.documentElement.clientHeight;
            var diameter = Math.min(w, h);
            //這里獲得了手機(jī)屏幕的寬高后,為了旋轉(zhuǎn)手機(jī)的時(shí)候?qū)е陆缑娌换靵y,需要將顯
            示的圖表設(shè)置為寬高最小的正方形(取巧)
            console.log(diameter);
            $(function() {
                var chart = iChart.create({
                    render: "ichart-render",
                    width: w,
                    height: w,
                    background_color: "#fefefe",
                    gradient: false,
                    color_factor: 0.2,
                    border: {
                        color: "BCBCBC",
                        width: 1
                    },
                    align: "center",
                    offsetx: 0,
                    offsety: 0,
                    sub_option: {
                        border: {
                            color: "#BCBCBC",
                            width: 1
                        },
                        label: {
                            fontweight: 500,
                            fontsize: 11,
                            color: "#4572a7",
                            sign: "square",
                            sign_size: 12,
                            border: {
                                color: "#BCBCBC",
                                width: 1
                            },
                            background_color: "#fefefe"
                        }
                    },
                    shadow: true,
                    shadow_color: "#666666",
                    shadow_blur: 2,
                    showpercent: false,
                    column_width: "70%",
                    bar_height: "70%",
                    radius: "90%",
                    title: {
                        text: "利用ichartjs制作漂亮圖表",
                        color: "#111111",
                        fontsize: 20,
                        font: "微軟雅黑",
                        textAlign: "center",
                        height: 30,
                        offsetx: 0,
                        offsety: 0
                    },
                    subtitle: {
                        text: "",
                        color: "#111111",
                        fontsize: 16,
                        font: "微軟雅黑",
                        textAlign: "center",
                        height: 20,
                        offsetx: 0,
                        offsety: 0
                    },
                    footnote: {
                        text: "",
                        color: "#111111",
                        fontsize: 12,
                        font: "微軟雅黑",
                        textAlign: "right",
                        height: 20,
                        offsetx: 0,
                        offsety: 0
                    },
                    legend: {
                        enable: false,
                        background_color: "#fefefe",
                        color: "#333333",
                        fontsize: 12,
                        border: {
                            color: "#BCBCBC",
                            width: 1
                        },
                        column: 1,
                        align: "right",
                        valign: "center",
                        offsetx: 0,
                        offsety: 0
                    },
                    coordinate: {
                        width: "80%",
                        height: "84%",
                        background_color: "#ffffff",
                        axis: {
                            color: "#a5acb8",
                            width: [1, "", 1, ""]
                        },
                        grid_color: "#d9d9d9",
                        label: {
                            fontweight: 500,
                            color: "#666666",
                            fontsize: 11
                        }
                    },
                    label: {
                        fontweight: 500,
                        color: "#666666",
                        fontsize: 11
                    },
                    type: "pie2d",
                    data: [{
                        name: "名稱A",
                        value: 20,
                        color: "#4572a7"
                    }, {
                        name: "名稱B",
                        value: 30,
                        color: "#aa4643"
                    }, {
                        name: "名稱C",
                        value: 40,
                        color: "#89a54e"
                    }, {
                        name: "新增",
                        value: 10,
                        color: "#4572a7"
                    }]
                });
                chart.draw();
            });
        
        
            #ichart-render {
                position: absolute;
                top: 20%;
            }
        
    

    
        
    

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。


網(wǎng)站名稱:H5跨平臺(tái)開發(fā)app之橫豎屏導(dǎo)致的圖表混亂問題-創(chuàng)新互聯(lián)
文章鏈接:http://weahome.cn/article/dpohii.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部