Reputation: 630
I'm trying to use the build in dataloader in amchart, problem is that no matter what it will not show a column graph for me.
my fiddle shows the code working but outcommented the problem.
I want to create the graph with dataloader and it returns exacly the same data as when i have typed it in myself... So i'm really stuck here :(
here is the code i'm trying to create the graph with:
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/
Upvotes: 0
Views: 121
Reputation: 16012
The dataloader is an external plugin like the export plugin. You need to include the plugin script after your chart includes, i.e.
<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 -->
Upvotes: 1