<button onclick="asc();">Ascending Order</button>
<button onclick="desc();">Descending Order</button>
<button onclick="none();">No Sorting</button>
<div id="container"></div>
html, body, #container {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
var chart;
function asc() {
// Set sorting.
chart.sort('asc');
function desc() {
chart.sort('desc');
function none() {
// Disable sorting.
chart.sort('none');
anychart.onDocumentReady(function () {
chart = anychart.pie([
{x: 'Cycling', value: 3},
{x: 'Swimming', value: 10},
{x: 'Run', value: 6},
{x: 'Hiking', value: 7},
{x: 'Alpinism', value: 20}
]);
chart.title('Set the sorting mode');
chart.container('container');
chart.draw();
});