Piwik\Plugins\CoreHome\DataTableRowAction\RowEvolution::getSparkline PHP Method

getSparkline() protected method

Get the img tag for a sparkline showing a single metric
protected getSparkline ( $metric )
    protected function getSparkline($metric)
    {
        // sparkline is always echoed, so we need to buffer the output
        $view = $this->getRowEvolutionGraph($graphType = 'sparkline', $metrics = array($metric => $metric));
        ob_start();
        $view->render();
        $spark = ob_get_contents();
        ob_end_clean();
        // undo header change by sparkline renderer
        Common::sendHeader('Content-type: text/html');
        // base64 encode the image and put it in an img tag
        $spark = base64_encode($spark);
        return '<img src="data:image/png;base64,' . $spark . '" />';
    }