Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (28 sloc) 1.12 KB
<h1>My amCharts Graph</h1>
<p>This is my amCharts graph</p>
<div id="chartdiv" style="width: 100%; height: 400px;"></div>
<script type="text/javascript">
var chart;
var chartData = <%= convert_to_amcharts_json(@countries) %>;
AmCharts.ready(function () {
// SERIAL CHART
chart = new AmCharts.AmSerialChart();
chart.dataProvider = chartData;
chart.categoryField = "country";
chart.startDuration = 1;
// AXES
// category
var categoryAxis = chart.categoryAxis;
categoryAxis.labelRotation = 90;
categoryAxis.gridPosition = "start";
// GRAPH
var graph = new AmCharts.AmGraph();
graph.valueField = "visits";
graph.balloonText = "[[category]]: [[value]]";
graph.type = "column";
graph.lineAlpha = 0;
graph.fillAlphas = 0.8;
chart.addGraph(graph);
chart.write("chartdiv");
});
</script>
Something went wrong with that request. Please try again.