You are here

function _quant_generate_table_multiple in Quant 6

Take formatted data for a multi-point chart and convert to a tabular format

File

includes/chart.inc, line 244
Chart building functions

Code

function _quant_generate_table_multiple(&$quant) {
  $label = "<h3>{$quant->label}</h3>";
  $width = $quant->chart['#size']['#width'];
  $headers = array(
    t('Label'),
    t('Data'),
  );
  $rows = array();
  foreach ($quant->data as $item => $data) {
    $irows = array();
    foreach ($data as $date => $count) {
      $irows[] = array(
        $date,
        $count,
      );
    }
    $rows[] = array(
      $item,
      theme('table', array(
        t('Date'),
        t('Count'),
      ), $irows),
    );
  }
  $table = theme('table', $headers, $rows);
  $quant->render = "<div class=\"quant-table\" style=\"width: {$width}px;\">{$label}{$table}</div>";
}