title: How to count sum of pixels in each class in a classified image (Landsat) in Google Earth Engine?
body: <p>I'm making a dissertation about glacier changes. 
  I did a supervised classification on a Landsat 8 image, and I would like to
  count how many pixels are there in each classes. I want to make a chart by the way. </p>
  
  <p>But I stucked, my code runs into error. 
  I tried to use ui.Chart.image.byClass() method with the specified parameters, but is does not works. </p>
  
  <p>My code: </p>
  
  <pre><code>var img = ee.Image('LANDSAT/LC8_L1T_TOA/LC81940282016238LGN00') ; 
  
  // Add pseudocolor image
  Map.addLayer(img, {bands: ['B6', 'B5', 'B4'] }, 'Pseudocolor image' ) ; 
  
  // Training points for classification - Point geometries
  var points = [class1,class2,class3, class4, class5] ; 
  var trainingPoints = ee.FeatureCollection(points) ; 
  
  var training = img.sampleRegions(trainingPoints, ['class'] ,30) ; 
  
  var trained = ee.Classifier.minimumDistance().train(training, 'class' ) ; 
  var classified = img.classify(trained) ; 
  
  var palette = ['red','red', '#696969' , '#90EE90' , '#008000' ]  ;
  
  Map.addLayer(classified, {min: 0 , max : 5 , palette : palette }, 'L8 
  classified' ) ; 
  
  print(classified); 
  
  var options = {
  lineWidth: 1,
  pointSize: 2,
  hAxis: {title: 'Classes'},
  vAxis: {title: 'Num of pixels'},
  title: 'Number of pixels in each class.'
  }; 
  
  var chart = ui.Chart.image.byClass({
  
  image : classified ,
  classBand : 'classification', 
  region : aletsch           //&lt;-- A previousy defined line type geometry
  }).setOptions(options) ; 
  </code></pre>
  
  <p>And the error what it throws: </p>
  
  <p>Dictionary.get: Dictionary does not contain key: groups.</p>
  
  <p>Is there any other tools to count the number of pixels in each classes? </p>