/** * @return string */ protected function prepareSalesChart() { $tooltip = null !== $this->jsTooltip ? $this->jsTooltip : Yii::t('app', 'Your sales for <b>{date}</b> was <span>{price} {code}</span>', ['date' => '%x', 'price' => '%y', 'code' => CurrencyHelper::getCurrencySymbol($this->currency)]); $shops = $this->getOrderSalesChart(Yii::$app->db, $this->currency); $periodTotalSold = $shops['totalSum']; $shops = [['label' => Yii::t('app', 'Main shop'), 'data' => $shops['orders']]]; $header = Yii::t('app', 'Last {period} sold for:', ['period' => Yii::t('app', $this->period)]) . ' ' . $this->currency->format($periodTotalSold); $data = ['tooltip' => $tooltip, 'header' => $header, 'dateFormat' => $this->dateFormat, 'shops' => $shops]; return $data; }