我试图在amchart中使用dataloader中的构建,问题是无论它不会为我显示列图。
我的小提示显示代码正常运行,但已将问题用完了。
我想用dataloader创建图表,它会像我在自己输入的那样返回相同的数据...所以我真的卡在这里:(
这是我尝试使用以下代码创建图表的代码:
var chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"theme": "light",
"marginRight": 70,
/*
"dataLoader": {
"url": "http://taponline.eu/datatablecalls/livedata/dispensesgraph.php",
"format": "json",
"headers": [{
"key": "x-access-token",
"value": "123456789"
}]
}
*/
"dataProvider": [{"pluName":"Classic","dispenses":1485},{"pluName":"Jul","dispenses":1224},{"pluName":"Gordons Gin 2 cl.","dispenses":163},{"pluName":null,"dispenses":0}],
"valueAxes": [{
"axisAlpha": 0,
"position": "left",
"title": "Dispense Count",
}],
"startDuration": 1,
"graphs": [{
"balloonText": "<b>[[category]]: [[value]]</b>",
"fillColorsField": "color",
"fillAlphas": 0.9,
"lineAlpha": 0.2,
"type": "column",
"valueField": "dispenses"
}],
"chartCursor": {
"categoryBalloonEnabled": false,
"cursorAlpha": 0,
"zoomable": false
},
"categoryField": "pluName",
"categoryAxis": {
"gridPosition": "start",
"labelRotation": 90
},
"export": {
"enabled": true
}
});
http://jsfiddle.net/szmoa8w9/2/
答案 0 :(得分:1)
dataloader是一个外部插件,如导出插件。您需要在图表包含之后包含插件脚本,即
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
<script src="https://www.amcharts.com/lib/3/serial.js"></script>
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
<!-- dataloader plugin -->
<script type="text/javascript" src="https://www.amcharts.com/lib/3/plugins/dataloader/dataloader.min.js"></script>
<!-- other plugins/themes afterward -->