简体   繁体   English

将AmCharts导出为PNG,JPG等

[英]Export AmCharts to PNG, JPG etc

I'm puzzled... 我很困惑

I'm sure this is a simple problem, but I'm not able to export my AmChart to jpg, png, etc. What am I doing wrong here? 我确定这是一个简单的问题,但是我无法将AmChart导出为jpg,png等。在这里我做错了什么?

<script src="/assets/javascripts/amcharts/amcharts.js"
type="text/javascript"></script>
<script src="/assets/javascripts/amcharts/serial.js"
type="text/javascript"></script>
<script src="/assets/javascripts/amcharts/themes/none.js"
type="text/javascript"></script>
<script src="/assets/javascripts/amcharts/exporting/amexport.js"
type="text/javascript"></script>
<script src="/assets/javascripts/amcharts/exporting/rgbcolor.js"
type="text/javascript"></script>
<script src="/assets/javascripts/amcharts/exporting/canvg.js"
type="text/javascript"></script>
<script src="/assets/javascripts/amcharts/exporting/filesaver.js"
type="text/javascript"></script>

"exportConfig": {
                "menuTop": "21px",
                "menuBottom": "auto",
                "menuRight": "21px",
                "backgroundColor": "#efefef",

               "menuItemStyle"  : {
                "backgroundColor"           : '#EFEFEF',
                "rollOverBackgroundColor"   : '#DDDDDD'},

                "menuItems": [{
                    "textAlign": 'center',
                    "icon": 'http://www.amcharts.com/lib/3/images/export.png',
                    "onclick":function(){},
                    "items": [{
                        "title": 'JPG',
                        "format": 'jpg'
                    }, {
                        "title": 'PNG',
                        "format": 'png'
                    }, {
                        "title": 'SVG',
                        "format": 'svg'
                    }]
                }]
            }

<div id="chartdiv" style="min-height: 600px;"></div>

I've followed AmChartExport and pretty much done exactly what they are doing. 我一直关注AmChartExport ,几乎完全按照他们的工作去做。 Disabled popups, and tried different browsers, but still the same result. 禁用弹出窗口,并尝试使用不同的浏览器,但结果仍然相同。 All of the javascript packages is recognized by the browser, and I'm displaying the button and the menu, but I nothing happens when I click ie "png". 浏览器可以识别所有javascript程序包,并且我正在显示按钮和菜单,但是单击“ png”时我什么也没有发生。

截图

The problem is solved with great help from the support at amChart.com amChart.com的支持下,该问题得到了极大的帮助

Here is the message I got. 这是我收到的消息。

The problem is that due to browser security restrictions, it cannot export charts that contain images loaded from other domains than the one displaying the chart. 问题在于,由于浏览器的安全性限制,它无法导出包含从其他域(而不是显示图表的域)加载的图像的图表。 Luckily it's pretty easy to fix, just update the following line: "pathToImages": " http://www.amcharts.com/lib/3/images/ ", To point to your own server. 幸运的是,它很容易修复,只需更新以下行:“ pathToImages”:“ http://www.amcharts.com/lib/3/images/ ”,指向您自己的服务器。

Did what I was told, and works great. 告诉了我,效果很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM