Closed vson1718 closed 4 years ago
Hi! We've received your issue and please be patient to get responded. 🎉 The average response time is expected to be within one day for weekdays.
In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.
If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical questions.
If you are interested in the project, you may also subscribe our mail list.
Have a nice day! 🍵
This problem should have nothing to do with ECharts. You can look for better screenshots. Example
此问题应该与ECharts无关。您可以寻找更好的屏幕截图。例
之前我也是这样认为的,但是为什么三星galaxy s11 出现这种问题,其他手机没有出现这个问题?
It should be that when the screenshot function gets content of the canvas , it can't get the pixel content of the canvas. I don't think ECharts can solve this problem .
它无法获取画布的像素内容
这个点击事件获取WebView内容的(webView已经全部渲染出来了),所以你说的无法获取画布的像素内容是不存在的
@vson1718 渲染出来不一定就是能够拿到像素数据了,webgl 就有一个属性 preserveDrawingBuffer,设置了 false 就没法拿到像素 buffer 中的数据。
只有 s11 有这个问题可能是因为 s11 中 capturePicture 存在兼容性问题,@yufeng04 发的链接 https://stackoverflow.com/questions/20942623/which-can-replace-capturepicture-function/20963109#20963109 里也提到了这个方法已经是 deprecated
@vson1718 渲染出来不一定就是能够拿到像素数据了,webgl 就有一个属性 preserveDrawingBuffer,设置了 false 就没法拿到像素 buffer 中的数据。
只有 s11 有这个问题可能是因为 s11 中 capturePicture 存在兼容性问题,@yufeng04 发的链接 https://stackoverflow.com/questions/20942623/which-can-replace-capturepicture-function/20963109#20963109 里也提到了这个方法已经是 deprecated
这个问题跟 echarts 并没有关系,你可以随便自己建一个 canvas 试一下
如果要绕过的话,你可以试试使用 svg 模式渲染
var chart = echarts.init(dom, null, { renderer: 'svg' });
Version
4.4.0
Steps to reproduce
1.使用webView打开Html(使用echarts4.4.0),显示正常(AndroidManifest.xml中设置属性Android:hardwareAccelerated=”false”。) 2.使用截图功能相关代码 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { WebView.enableSlowWholeDocumentDraw(); }
private Bitmap captureWebView(WebView webView){
Picture picture = webView.capturePicture();
int width = picture.getWidth();
int height = picture.getHeight();
if (width > 0 && height > 0) {
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
Canvas canvas = new Canvas(bitmap);
picture.draw(canvas);
return bitmap;
}
return null;
}
What is expected?
三星galaxy s11 使用 Webview 截图echarts 区域不显示空白
What is actually happening?
三星galaxy s11 使用 Webview 截图echarts 区域显示空白
截图WebView,分享到微信