Highcharts test tool
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container"></div>
CSS
#container {
min-width: 300px;
max-width: 800px;
height: 300px;
margin: 1em auto;
}
JavaScript
// Get the chart definition from the server. Note, dataLabelFunction is a string, not supported by highcharts.
var chart = {
"dataLabelFunction":"return this.point.name+': '+this.percentage.toFixed(1) + '%'",
"plotOptions": {
"series": {"animation": {"duration": 500}}
,"pie": {
"allowPointSelect": true,
"cursor": "pointer"
}
},
"chart":{"renderTo":"divReportChart"}
,"title":{"text":"Sales Totals"}
,"xAxis":{"title":{"text":"Item"}, "categories":["Taxes","Discounts","NetSalesTotal"], "gridLineWidth":1}
,"yAxis":[{"title":{"text":"Amount"}, "gridLineWidth":1}]
,"series":[{"name":"Amount","type":"pie", "startAngle": -60,"yAxis": 0,"data":[["Taxes",17.8700],["Discounts",36.0000],["NetSalesTotal",377.9500]]}]
};
// Turn the string into a function.
var fn = Function(chart.dataLabelFunction);
// Tell highcharts to use the new functon
chart.plotOptions.pie.dataLabels = {"formatter":fn};
// Render the chart.
$('#container').highcharts(
chart
);