Skip to content

Commit

Permalink
covid19 stats visualization improved
Browse files Browse the repository at this point in the history
  • Loading branch information
nightflyza committed Nov 10, 2021
1 parent 5633de4 commit 0553762
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.2 rev 8212
1.2.2 rev 8213
22 changes: 19 additions & 3 deletions modules/general/covid19/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,11 @@ public function renderCountry() {

$charsDataTotal[] = array(__('Date'), __('Confirmed'), __('Deaths'), __('Recovered'));
$charsDataMonth[] = array(__('Date'), __('Confirmed'), __('Deaths'), __('Recovered'));
$charsDataPeaks[] = array(__('Date'), __('Confirmed'), __('Deaths'));
$charsDataPeaksAll[] = array(__('Date'), __('Confirmed'), __('Deaths'));
$charsDataPeaksYear[] = array(__('Date'), __('Confirmed'), __('Deaths'));
$charsDataPeaksMonth[] = array(__('Date'), __('Confirmed'), __('Deaths'));
$curMonth = curmonth() . '-';
$curYear = curyear() . '-';
$prevConf = 0;
$prevDeaths = 0;
foreach ($countryTimeline as $io => $each) {
Expand All @@ -243,9 +246,18 @@ public function renderCountry() {
$charsDataMonth[] = array($date, $each['confirmed'], $each['deaths'], $each['recovered']);
$curMonthCount++;
}

$charsDataTotal[] = array($date, $each['confirmed'], $each['deaths'], $each['recovered']);

$charsDataPeaks[] = array($date, ($each['confirmed'] - $prevConf), ($each['deaths'] - $prevDeaths));
$peakConfirmed = $each['confirmed'] - $prevConf;
$peakDeaths = $each['deaths'] - $prevDeaths;
$charsDataPeaksAll[] = array($date, $peakConfirmed, $peakDeaths);
if (ispos($date, $curYear)) {
$charsDataPeaksYear[] = array($date, $peakConfirmed, $peakDeaths);
}
if (ispos($date, $curMonth)) {
$charsDataPeaksMonth[] = array($date, $peakConfirmed, $peakDeaths);
}
$lastData = $each;
$lastConf = $lastData['confirmed'] - $prevConf;
$lastDeath = $lastData['deaths'] - $prevDeaths;
Expand All @@ -261,7 +273,11 @@ public function renderCountry() {
$result .= $this->messages->getStyledMessage(__('Recovered') . ' ' . $lastData['recovered'], 'success');
$result .= $this->messages->getStyledMessage(__('For the last day') . ' ' . $date . ' (' . __('Confirmed') . '/' . __('Deaths') . ') ' . $lastConf . '/' . $lastDeath, 'info');

$result .= wf_gchartsLine($charsDataPeaks, __('By date'), '100%', '300px;', $chartsOptions);
if ($curMonthCount > 0) {
$result .= wf_gchartsLine($charsDataPeaksMonth, __('By date') . ' (' . __('Current month') . ')', '100%', '300px;', $chartsOptions);
}
$result .= wf_gchartsLine($charsDataPeaksYear, __('By date') . ' (' . __('Current year') . ')', '100%', '300px;', $chartsOptions);
$result .= wf_gchartsLine($charsDataPeaksAll, __('By date') . ' (' . __('All time') . ')', '100%', '300px;', $chartsOptions);
if ($curMonthCount > 0) {
$result .= wf_gchartsLine($charsDataMonth, __('Month'), '100%', '300px;', $chartsOptions);
}
Expand Down

0 comments on commit 0553762

Please sign in to comment.