<?php

class DangerousGoodsStatGraphEncoder
{

  static public function encode (array $data, $xField, $yField)
  {
    $graphData = array();
    foreach($data as $key => $row)
    {
      $graphData[$key]['x'] = $row->$xField;
      $graphData[$key]['y'] = $row->$yField;
    }
    return CJSON::encode($graphData);
  }
}


