1<?php 2/** 3 * webtrees: online genealogy 4 * Copyright (C) 2018 webtrees development team 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 */ 16declare(strict_types=1); 17 18namespace Fisharebest\Webtrees\Statistics\Google; 19 20use Fisharebest\Webtrees\I18N; 21use Fisharebest\Webtrees\Statistics\AbstractGoogle; 22 23/** 24 * 25 */ 26class ChartSex extends AbstractGoogle 27{ 28 /** 29 * Generate a chart showing sex distribution. 30 * 31 * @param int $tot_m The total number of male individuals 32 * @param int $tot_f The total number of female individuals 33 * @param int $tot_u The total number of unknown individuals 34 * @param string|null $color_female 35 * @param string|null $color_male 36 * @param string|null $color_unknown 37 * 38 * @return string 39 */ 40 public function chartSex( 41 int $tot_m, 42 int $tot_f, 43 int $tot_u, 44 string $color_female = null, 45 string $color_male = null, 46 string $color_unknown = null 47 ): string { 48 $color_female = $color_female ?? '#ffd1dc'; 49 $color_male = $color_male ?? '#84beff'; 50 $color_unknown = $color_unknown ?? '#777777'; 51 52 $data = [ 53 [ 54 I18N::translate('Type'), 55 I18N::translate('Total') 56 ], 57 [ 58 I18N::translate('Males'), 59 $tot_m 60 ], 61 [ 62 I18N::translate('Females'), 63 $tot_f 64 ], 65 [ 66 I18N::translate('Unknown'), 67 $tot_u 68 ], 69 ]; 70 71 return view( 72 'statistics/other/charts/pie', 73 [ 74 'title' => null, 75 'data' => $data, 76 'colors' => [$color_male, $color_female, $color_unknown], 77 'labeledValueText' => 'percentage', 78 ] 79 ); 80 } 81} 82