summaryrefslogtreecommitdiff
path: root/app/Stats.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2015-08-06 21:39:56 +0100
committerGreg Roach <fisharebest@gmail.com>2015-08-06 21:43:26 +0100
commit18c11746ab90b6d39358646747acbb823f6fed6b (patch)
tree96fb5f743af6f8da1917fc9756191d7f9415835a /app/Stats.php
parent48994ef760a0b8e4cf63bc2b7a896d7ae50be866 (diff)
downloadwebtrees-18c11746ab90b6d39358646747acbb823f6fed6b.tar.gz
webtrees-18c11746ab90b6d39358646747acbb823f6fed6b.tar.bz2
webtrees-18c11746ab90b6d39358646747acbb823f6fed6b.zip
Children/family chart fails when average number of children more than 10
Diffstat (limited to 'app/Stats.php')
-rw-r--r--app/Stats.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/Stats.php b/app/Stats.php
index af88ff0e40..7e85a05ce1 100644
--- a/app/Stats.php
+++ b/app/Stats.php
@@ -4933,8 +4933,10 @@ class Stats {
$chxl .= $this->centuryName($values['century']) . "|";
if ($max <= 5) {
$counts[] = round($values['num'] * 819.2 - 1, 1);
- } else {
+ } elseif ($max <= 10) {
$counts[] = round($values['num'] * 409.6, 1);
+ } else {
+ $counts[] = round($values['num'] * 204.8, 1);
}
$chm .= 't' . $values['num'] . ',000000,0,' . $i . ',11,1|';
$i++;
@@ -4943,8 +4945,10 @@ class Stats {
$chm = substr($chm, 0, -1);
if ($max <= 5) {
$chxl .= "1:||" . I18N::translate('century') . "|2:|0|1|2|3|4|5|3:||" . I18N::translate('Number of children') . "|";
- } else {
+ } elseif ($max <= 10) {
$chxl .= "1:||" . I18N::translate('century') . "|2:|0|1|2|3|4|5|6|7|8|9|10|3:||" . I18N::translate('Number of children') . "|";
+ } else {
+ $chxl .= "1:||" . I18N::translate('century') . "|2:|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|3:||" . I18N::translate('Number of children') . "|";
}
return "<img src=\"https://chart.googleapis.com/chart?cht=bvg&amp;chs={$sizes[0]}x{$sizes[1]}&amp;chf=bg,s,ffffff00|c,s,ffffff00&amp;chm=D,FF0000,0,0,3,1|{$chm}&amp;chd=e:{$chd}&amp;chco=0000FF&amp;chbh=30,3&amp;chxt=x,x,y,y&amp;chxl=" . rawurlencode($chxl) . "\" width=\"{$sizes[0]}\" height=\"{$sizes[1]}\" alt=\"" . I18N::translate('Average number of children per family') . "\" title=\"" . I18N::translate('Average number of children per family') . "\" />";