Canvas js export启用不能在android设备上运行

Moe*_*eez 13 javascript android canvasjs

我正在研究CANVASjS并构建一个在图表上显示数据的示例应用程序.我已经启用export保存在图表.png.jpeg和打印也.虽然ripple emulator在导出上部署它是完美的,但是当我部署它时android device它不起作用.下面是我启用导出的代码部分.

var chart = new CanvasJS.Chart("container", {
            zoomEnabled: true,
            zoomType: "xy",
            animationEnabled: true,
            animationDuration: 2000,
            exportEnabled: true,
// all other chart code 
});
Run Code Online (Sandbox Code Playgroud)

更新1:

 function drawChart(data)
            {
                var chart = new CanvasJS.Chart("container", {
                    zoomEnabled: true,
                    zoomType: "xy",
                    animationEnabled: true,
                    animationDuration: 2000,
                    exportEnabled: true,
                    exportFileName: "Column Chart",
                    title: {
                        text: "Energy vs Date Time"
                    },
                    axisY: {
                        title: "EnergykWh",
                        interlacedColor: "#F8F1E4",
                        tickLength: 10,
                        suffix: "k",
                    },
                    legend: {
                        cursor: "pointer",
                        itemclick: function (e) {
                            if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
                                e.dataSeries.visible = false;
                            } else {
                                e.dataSeries.visible = true;
                            }
                            e.chart.render();
                        }
                    },
                    dataPointWidth: 20,
                    data: [{
                        //legendText: "EngergykWh",
                        showInLegend: true,
                        type: 'column',
                        //xValueType: "dateTime",
                        xValueFormatString: "DD/MMM/YYYY h:mm TT",
                        //xValueFormatString: "YYYY-MM-DD hh:mm:ss TT",
                        showInLegend: true,
                        name: "series1",
                        legendText: "EnergykWh",
                        dataPoints: data                          
                    }]
                });

                chart.render();
            }
Run Code Online (Sandbox Code Playgroud)

更新2:

Bellow是我试过的信息图片和Android设备操作系统版本的链接

在此输入图像描述

在此输入图像描述

Galaxy j7 2015

我不知道它的主要问题是什么.任何帮助将受到高度赞赏.

Vis*_*s R 7

您已在webview中创建了下载管理器,因此您需要手动处理下载功能.有两种方法可以从webview下载文件.

1.使用Android下载管理器

2.使用从webview打开的网络浏览器(内部使用Android下载管理器)

所需权限包括WRITE_EXTERNAL_STORAGE

然后为webview设置下载监听器.

webView.setDownloadListener(new DownloadListener(){
    public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength){
        //for downloading directly through download manager
        Request request = new Request(Uri.parse(url));
        request.allowScanningByMediaScanner();
        request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
        request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "download");
        DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
        dm.enqueue(request);
    }
});
Run Code Online (Sandbox Code Playgroud)

请参考以下链接,了解更多信息:链接1,链路2,链路3,链路4