public function values($start = -6, $end = 0)
    {
        $start = (int) $start;
        $end = (int) $end;

        // go N points in the past
        if ($start < 0) {
            $granularity = $this->granularity();
            if ($granularity == STATISTIC_GRANULARITY_DAY) {
                $nPrevious = strtotime($start.' days');
                $start = mktime(0, 0, 0, date('m', $nPrevious), date('d', $nPrevious), date('Y', $nPrevious));
            } elseif ($granularity == STATISTIC_GRANULARITY_WEEK) {
                $nPrevious = strtotime($start.' weeks');
                $start = mktime(0, 0, 0, date('m', $nPrevious), date('d', $nPrevious), date('Y', $nPrevious));
            } elseif ($granularity == STATISTIC_GRANULARITY_MONTH) {
                $nPrevious = strtotime($start.' months');
                $start = mktime(0, 0, 0, date('m', $nPrevious), 1, date('Y', $nPrevious));
            } elseif ($granularity == STATISTIC_GRANULARITY_YEAR) {
                $nPrevious = strtotime($start.' years');
                $start = mktime(0, 0, 0, 1, 1, date('Y', $nPrevious));
            }
        }

        // end should include the present value
        $includePresent = $end == 0 || $end - time() >= 0;
        if ($includePresent) {
            $end = time();
        }

        $values = $this->app['db']->select('day,val')->from('Statistics')->where([
            'metric' => $this->key(),
            ['ts', $start, '>='],
            ['ts', $end, '<='], ])->all();

        // add present point
        if ($includePresent) {
            $values[] = [
                'day' => date('Y-m-d'),
                'val' => $this->computeValue(), ];
        }

        return $values;
    }