amcharts Pie with legend
HTML
<script src="http://www.amcharts.com/lib/amcharts.js" type="text/javascript"></script>
<div id="chartdiv" style="width: 100%; height: 362px;"></div>
CSS
body
{
font-size:12px;
color:#000000;
background-color:#ffffff;
font-family:verdana,helvetica,arial,sans-serif;
}
JavaScript
var chart;
var legend;
var chartData = [{
country: "Czech Republic",
litres: 156.90},
{
country: "Ireland",
litres: 131.10},
{
country: "Germany",
litres: 115.80},
{
country: "Australia",
litres: 109.90},
{
country: "Austria",
litres: 108.30},
{
country: "UK",
litres: 65.00},
{
country: "Belgium",
litres: 50.00}];
// create chart
AmCharts.ready(function() {
// PIE CHART
chart = new AmCharts.AmPieChart();
chart.dataProvider = chartData;
chart.titleField = "country";
chart.valueField = "litres";
// LEGEND
legend = new AmCharts.AmLegend();
legend.align = "center";
legend.markerType = "circle";
chart.addLegend(legend);
// WRITE
chart.write("chartdiv");
});