Вопрос

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?

<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. 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 i.e "png".

Screenshot

Это было полезно?

Решение

The problem is solved with great help from the support at 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.

Did what I was told, and works great.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top