class QuantChartTable in Quant 7
QuantChart plugin to provide simple HTML table charts
Hierarchy
- class \QuantChart
- class \QuantChartTable
Expanded class hierarchy of QuantChartTable
1 string reference to 'QuantChartTable'
- quant_quant_charts in ./
quant.quant.inc - Implements hook_quant_charts().
File
- plugins/
QuantChartTable.inc, line 6
View source
class QuantChartTable extends QuantChart {
var $output = NULL;
var $rows = NULL;
var $header = NULL;
var $table = NULL;
/**
* Implements parent::build().
*/
function build() {
switch ($this->quant->dataType) {
case 'single':
$this
->build_single();
break;
case 'multiple':
$this
->build_multiple();
break;
case 'count':
$this
->build_count();
break;
}
}
/**
* Implements parent::render().
*/
function render() {
// Generate the table
$this->table = theme('table', array(
'header' => $this->header,
'rows' => $this->rows,
));
// Generate the output
$this->output = theme('quant_table', array(
'table' => $this->table,
'title' => $this->quant->label,
'width' => variable_get('quant_width', 500),
));
// Return the output
return $this->output;
}
/**
* Build a table chart for single datapoints
*/
function build_single() {
$this->header = array(
t('Date'),
t('Count'),
);
$this->rows = array();
foreach ($this->quant->data->data as $date => $count) {
$this->rows[] = array(
$date,
$count,
);
}
}
/**
* Build a table chart for multiple datapoints
*/
function build_multiple() {
$this->header = array(
t('Label'),
t('Data'),
);
$this->rows = array();
foreach ($this->quant->data->data as $item => $data) {
$irows = array();
foreach ($data as $date => $count) {
$irows[] = array(
$date,
$count,
);
}
$this->rows[] = array(
$item,
theme('table', array(
'header' => array(
t('Date'),
t('Count'),
),
'rows' => $irows,
)),
);
}
}
/**
* Build a table chart for count data
*/
function build_count() {
$this->header = array(
t('Label'),
t('Count'),
);
$this->rows = array();
foreach ($this->quant->data->data as $title => $count) {
$this->rows[] = array(
$title,
$count,
);
}
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
QuantChart:: |
property | |||
QuantChart:: |
property | |||
QuantChart:: |
function | Provide additional admin settings to the form | 1 | |
QuantChart:: |
function | Submit the admin settings form | ||
QuantChart:: |
function | Validate the admin settings form | 1 | |
QuantChart:: |
function | Provide a list of Drupal variables handled by this plugin so they can be properly removed during module uninstall | 1 | |
QuantChart:: |
function | |||
QuantChartTable:: |
property | |||
QuantChartTable:: |
property | |||
QuantChartTable:: |
property | |||
QuantChartTable:: |
property | |||
QuantChartTable:: |
function |
Implements parent::build(). Overrides QuantChart:: |
||
QuantChartTable:: |
function | Build a table chart for count data | ||
QuantChartTable:: |
function | Build a table chart for multiple datapoints | ||
QuantChartTable:: |
function | Build a table chart for single datapoints | ||
QuantChartTable:: |
function |
Implements parent::render(). Overrides QuantChart:: |