Sort Disable Option Issue

19 views
Skip to first unread message

Naresh Kumar Sanda

unread,
Sep 28, 2017, 9:29:53 AM9/28/17
to Google Visualization API
Hello Team,

Below is my code and my requirement is to disable the sort.

I want the graph to be plotted like AAA[600],CCC[200],BBB[400] respectively. 

But Actually it is plotting like CCC[200],BBB[400],AAA[600] based on the sum values it is plotting the graph .

Please help me out how I can Achieve my requirement .

Belowis the Code Snippet of the chart .


<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script>
google.load('visualization', '1', {packages:['corechart'], callback:createCharts});
function createCharts() {
drawRolesChart();
}
   
function drawRolesChart() {
  var data = new google.visualization.DataTable();
  data.addColumn('number', 'id');
  data.addColumn('string', 'customername');
  data.addColumn('number', 'revenue');

  data.addRow([1,'AAA', 300]);
  data.addRow([2,'CCC', 200]);
  data.addRow([3,'AAA', 300]);
  data.addRow([4,'BBB', 400]);
  
 
  var agg_MAX_REVENUE =  google.visualization.data.group(data, [1],[
  {'column':2, 'aggregation':google.visualization.data.sum, 'type': 'number',label:'revenue'}]);
  agg_MAX_REVENUE.sort({column: 1, sort: 'disable'});
  
   var chart = new google.visualization.ColumnChart(document.getElementById('roles_chart_sum'));
   chart.draw(agg_MAX_REVENUE, {width: 400, height: 300, legend:'none'});
}
</script>

<body>
<div id="roles_chart_sum"></div>


Thanks,
Naresh


Reply all
Reply to author
Forward
0 new messages