apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.59k stars 19.62k forks source link

设备像素比不等于1的时候,会出现模糊,特别文字模糊严重 #8626

Closed mingyuezhaohuahai closed 3 years ago

mingyuezhaohuahai commented 6 years ago

One-line summary [问题简述]

设备像素比不等于1的时候,会出现模糊,特别文字模糊严重

Version & Environment [版本及环境]

解决方法:dist/echarts.js 6785行的resize();

resize: function (width, height) {
        var dpr = this.dpr;

        var dom = this.dom;
        var domStyle = dom.style;
        var domBack = this.domBack;

        if (domStyle) {
            domStyle.width = width + 'px';
            domStyle.height = height + 'px';
        }

        // 设备像素比设配 ----------------------
        dom.style.width = width;
        dom.style.height = height;
       // ----------------------------------------

        dom.width = width * dpr;
        dom.height = height * dpr;

        if (domBack) {
            domBack.width = width * dpr;
            domBack.height = height * dpr;

            if (dpr != 1) {
                this.ctxBack.scale(dpr, dpr);
            }
        }
    },

Expected behaviour [期望结果]

ECharts option [ECharts配置项]

option = {

}

Other comments [其他信息]

pissang commented 6 years ago

没看到问题在哪

mingyuezhaohuahai commented 6 years ago

就是,用echarts4.1.0版本绘图。同事反应坐标轴模糊了,最后发现是因为他的电脑window.devicePixelRatio=1.5 。改了echarts.js源码的6785行的方法,问题就解决了。

yizhengfeng-jj commented 5 years ago

请问你的改动就是增加了这个了么 dom.style.width = width; dom.style.height = height;

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 3 years ago

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!