Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 显示不同行为的amCharts系列图表_Javascript_Amcharts - Fatal编程技术网

Javascript 显示不同行为的amCharts系列图表

Javascript 显示不同行为的amCharts系列图表,javascript,amcharts,Javascript,Amcharts,我正在使用我的应用程序。最近,我将其从版本3.17.0更新为3.20.6 在我的应用程序中,我使用export withcapture方法捕获图像,如下所示: if (window.fabric) { clearTimeout(interval); // CAPTURE CHART chart.export.capture({}, function() {

我正在使用我的应用程序。最近,我将其从版本
3.17.0
更新为
3.20.6

在我的应用程序中,我使用export with
capture
方法捕获图像,如下所示:

if (window.fabric) {
                    clearTimeout(interval);

                    // CAPTURE CHART
                    chart.export.capture({}, function() {

                        // SAVE TO JPG
                        this.toPNG({}, function(base64) {

                            //some code
                                                    });
                    });
                }
 }, 10); 
在我的带有图表光标的系列图表中,它运行良好,如前一版本中的下面所示。如图所示:

更新版本后,它显示了奇怪的行为:ChartCursor消失了,拖动光标时,它正在图表上画线

我已经在amChart网站上检查过了,我已经正确设置了所有内容

这里有什么问题

如果我禁用chart.export.capture,它将正常工作。
以下是设置属性图表的代码:

"type": "serial",
                "theme": "none",
                "pathToImages": "resources/javascript/amcharts/images/",
                "marginTop": 1,
                "marginBottom": 1,
                "autoMarginOffset": offsetM,
                //left hand side space between container and chart
                "zoomOutButtonRollOverAlpha": 0.15,

                "zoomControl": {
                    "zoomControlEnabled": true,
                    "backgroundAlpha": "0.15",
                    "backgroundColor": "#000000"
                },

                "dataProvider": valueChartData,
                "columnWidth": 1,
                "categoryField": "date",
                "categoryAxis": {
                    "minPeriod": "DD",
                    "parseDates": true
                },

                "export": {
                    "enabled": false,
                    "menu": []
                }
用于导出和克隆图表:

var interval = setInterval(function() {
                    if (window.fabric) {
                        clearTimeout(interval);

                        // CAPTURE CHART
                        main.pageContainerBulkMarketing.bulkmarketing.pageContainerBMReports.reports.chart["export"].capture({}, function() {

                            // SAVE TO JPG
                            this.toPNG({}, function(base64) {

                                somewhere.OpenedTabGrpClone = "";
                                somewhere.OpenedTabGrpClone = base64;
                            });
                        });
                    }
                }, 10);
注意:我观察到一件事:它在我们的chart div上添加了一个canvas标记,如下所示:

<canvas class="upper-canvas " style="position: absolute; width: 802px; height: 360px; left: 0px; top: 0px; -moz-user-select: none; cursor: crosshair;" width="802" height="360"></canvas>

更新:在这里我已经补充了,但是,在这里它工作得很好,我花了这段时间来找出为什么它不在我这边工作;结果:没有

简单地做到这一点

1)检查你的库链接和插件代码,它可能会干扰其他js或插件

2)还可以使用实时amchart库测试代码


3)如果一切正常,将画布标记的Z索引设置为-1

您是否在浏览器的控制台中发现任何错误?或者有链接让我们查一下?嗯。。否,浏览器控制台中没有任何错误。如果需要的话,我可以在这里更新更多相关的代码。事实上,问题出在canvas控件上,请检查创建canvas控件的代码。您可以在codepen或jsfiddle上设置一个工作示例吗?如果没有它,它只是猜测和试图填补空白。您的图形显示似乎正确,但画布替换鼠标光标点区域