Piwik\Plugins\ExampleUI\API::getTemperaturesEvolution PHP Method

getTemperaturesEvolution() public method

public getTemperaturesEvolution ( $date, $period )
    public function getTemperaturesEvolution($date, $period)
    {
        $temperatures = array();
        $date = Date::factory('2013-10-10', 'UTC');
        $period = new Range($period, 'last30');
        $period->setDefaultEndDate($date);
        foreach ($period->getSubperiods() as $subPeriod) {
            if (self::$disableRandomness) {
                $server1 = 50;
                $server2 = 40;
            } else {
                $server1 = mt_rand(50, 90);
                $server2 = mt_rand(40, 110);
            }
            $value = array('server1' => $server1, 'server2' => $server2);
            $temperatures[$subPeriod->getLocalizedShortString()] = $value;
        }
        return DataTable::makeFromIndexedArray($temperatures);
    }