如何允许在移动设备上滚动amCharts?

时间:2017-10-28 05:29:09

标签: javascript jquery amcharts

我正在使用这样的amCharts圆环图:https://www.amcharts.com/demos/donut-chart/

我创建此图表的JS代码是:



var results = getJsData().responses;


var chart = AmCharts.makeChart("chartdiv", {
    "type": "pie",
    "startDuration": 0,
    "theme": "light",
    "labelRadius": -35,
    "labelText": "[[percents]]%",
    "addClassNames": true,
    "legend":{
        "position":"bottom",
        "marginRight":100,
        "autoMargins":false
    },
    "innerRadius": "30%",
    "defs": {
        "filter": [{
            "id": "shadow",
            "width": "200%",
            "height": "200%",
            "feOffset": {
                "result": "offOut",
                "in": "SourceAlpha",
                "dx": 0,
                "dy": 0
            },
            "feGaussianBlur": {
                "result": "blurOut",
                "in": "offOut",
                "stdDeviation": 5
            },
            "feBlend": {
                "in": "SourceGraphic",
                "in2": "blurOut",
                "mode": "normal"
            }
        }]
    },
    "dataProvider": results,
    "valueField": "votes",
    "titleField": "response"
});

chart.addListener("init", handleInit);

chart.addListener("rollOverSlice", function(e) {
    handleRollOver(e);
});

function handleInit(){
    chart.legend.addListener("rollOverItem", handleRollOver);
}

function handleRollOver(e){
    var wedge = e.dataItem.wedge.node;
    wedge.parentNode.appendChild(wedge);
}




这看起来很好,即使在移动设备上,但问题是当我尝试在移动设备上滚动时(触摸amChart图表,因为此图表占据屏幕的大部分)没有任何反应。

我该如何解决?

1 个答案:

答案 0 :(得分:0)

您是否尝试将“panEventsEnabled”属性添加为false?