public function render()
{
// If period=range, we force the sparkline to draw daily data points
$period = Common::getRequestVar('period');
if ($period == 'range') {
$_GET['period'] = 'day';
}
$this->loadDataTableFromAPI();
// then revert the hack for potentially subsequent getRequestVar
$_GET['period'] = $period;
$values = $this->getValuesFromDataTable($this->dataTable);
if (empty($values)) {
$values = array_fill(0, 30, 0);
}
$graph = new \Piwik\Visualization\Sparkline();
$graph->setValues($values);
$height = Common::getRequestVar('height', 0, 'int');
if (!empty($height)) {
$graph->setHeight($height);
}
$width = Common::getRequestVar('width', 0, 'int');
if (!empty($width)) {
$graph->setWidth($width);
}
$graph->main();
return $graph->render();
}