src/Webtrees/Module/Sosa/SosaStatsController.php
private function htmlAncestorDispersionG2()
    {
        $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(2);
        if(count($ancestorsDispGen2) == 0) return;
        
        $size = '600x300';
        
        $total = array_sum($ancestorsDispGen2);
        $father_count = array_key_exists(1, $ancestorsDispGen2) ? $ancestorsDispGen2[1] : 0;
        $father = array (
            'color' => '84beff', 
            'count' => $father_count, 
            'perc' => Functions::safeDivision($father_count, $total), 
            'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fat')            
        );
        $mother_count = array_key_exists(2, $ancestorsDispGen2) ? $ancestorsDispGen2[2] : 0;
        $mother = array (
            'color' => 'ffd1dc', 
            'count' => $mother_count, 
            'perc' => Functions::safeDivision($mother_count, $total),
            'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('mot')
        );
        $shared_count = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0;
        $shared = array (
            'color' => '777777', 
            'count' => $shared_count, 
            'perc' => Functions::safeDivision($shared_count, $total),
            'name' => I18N::translate('Shared')
        );
        
        $chd = $this->arrayToExtendedEncoding(array(4095 * $father['perc'], 4095 * $shared['perc'], 4095 * $mother['perc']));
        $chart_title = I18N::translate('Known Sosa ancestors\' dispersion');
        $chl = 
             $father['name'] . ' - ' . I18N::percentage($father['perc'], 1) . '|' .
             $shared['name'] . ' - ' . I18N::percentage($shared['perc'], 1) . '|' .
             $mother['name'] . ' - ' . I18N::percentage($mother['perc'], 1);
        return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&amp;chd=e:{$chd}&amp;chs={$size}&amp;chco={$father['color']},{$shared['color']},{$mother['color']}&amp;chf=bg,s,ffffff00&amp;chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />";
    }
private function htmlAncestorDispersionG2()
    {
        $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(2);
        if(count($ancestorsDispGen2) == 0) return;
        
        $size = '600x300';
        
        $total = array_sum($ancestorsDispGen2);
        $father_count = array_key_exists(1, $ancestorsDispGen2) ? $ancestorsDispGen2[1] : 0;
        $father = array (
            'color' => '84beff', 
            'count' => $father_count, 
            'perc' => Functions::safeDivision($father_count, $total), 
            'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fat')            
        );
        $mother_count = array_key_exists(2, $ancestorsDispGen2) ? $ancestorsDispGen2[2] : 0;
        $mother = array (
            'color' => 'ffd1dc', 
            'count' => $mother_count, 
            'perc' => Functions::safeDivision($mother_count, $total),
            'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('mot')
        );
        $shared_count = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0;
        $shared = array (
            'color' => '777777', 
            'count' => $shared_count, 
            'perc' => Functions::safeDivision($shared_count, $total),
            'name' => I18N::translate('Shared')
        );
        
        $chd = $this->arrayToExtendedEncoding(array(4095 * $father['perc'], 4095 * $shared['perc'], 4095 * $mother['perc']));
        $chart_title = I18N::translate('Known Sosa ancestors\' dispersion');
        $chl = 
             $father['name'] . ' - ' . I18N::percentage($father['perc'], 1) . '|' .
             $shared['name'] . ' - ' . I18N::percentage($shared['perc'], 1) . '|' .
             $mother['name'] . ' - ' . I18N::percentage($mother['perc'], 1);
        return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&amp;chd=e:{$chd}&amp;chs={$size}&amp;chco={$father['color']},{$shared['color']},{$mother['color']}&amp;chf=bg,s,ffffff00&amp;chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />";
    }
private function htmlAncestorDispersionG2 ( ) { $ ancestorsDispGen2 = $ this -> sosa_provider -> getAncestorDispersionForGen ( 2 ) ; if ( count ( $ ancestorsDispGen2 ) == 0 ) return ; $ size = '600x300' ; $ total = array_sum ( $ ancestorsDispGen2 ) ; $ father_count = array_key_exists ( 1 , $ ancestorsDispGen2 ) ? $ ancestorsDispGen2 [ 1 ] : 0 ; $ father = array ( 'color' => '84beff' , 'count' => $ father_count , 'perc' => Functions :: safeDivision ( $ father_count , $ total ) , 'name' => \ Fisharebest \ Webtrees \ Functions \ Functions :: getRelationshipNameFromPath ( 'fat' ) ) ; $ mother_count = array_key_exists ( 2 , $ ancestorsDispGen2 ) ? $ ancestorsDispGen2 [ 2 ] : 0 ; $ mother = array ( 'color' => 'ffd1dc' , 'count' => $ mother_count , 'perc' => Functions :: safeDivision ( $ mother_count , $ total ) , 'name' => \ Fisharebest \ Webtrees \ Functions \ Functions :: getRelationshipNameFromPath ( 'mot' ) ) ; $ shared_count = array_key_exists ( - 1 , $ ancestorsDispGen2 ) ? $ ancestorsDispGen2 [ - 1 ] : 0 ; $ shared = array ( 'color' => '777777' , 'count' => $ shared_count , 'perc' => Functions :: safeDivision ( $ shared_count , $ total ) , 'name' => I18N :: translate ( 'Shared' ) ) ; $ chd = $ this -> arrayToExtendedEncoding ( array ( 4095 * $ father [ 'perc' ] , 4095 * $ shared [ 'perc' ] , 4095 * $ mother [ 'perc' ] ) ) ; $ chart_title = I18N :: translate ( 'Known Sosa ancestors\' dispersion' ) ; $ chl = $ father [ 'name' ] . ' - ' . I18N :: percentage ( $ father [ 'perc' ] , 1 ) . '|' . $ shared [ 'name' ] . ' - ' . I18N :: percentage ( $ shared [ 'perc' ] , 1 ) . '|' . $ mother [ 'name' ] . ' - ' . I18N :: percentage ( $ mother [ 'perc' ] , 1 ) ; return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&amp;chd=e:{$chd}&amp;chs={$size}&amp;chco={$father['color']},{$shared['color']},{$mother['color']}&amp;chf=bg,s,ffffff00&amp;chl={$chl}\" alt=\"" . $ chart_title . "\" title=\"" . $ chart_title . "\" />" ; }
Returns HTML code for a graph showing the dispersion of ancestors across father & mother
@return string HTML code
Returns HTML code for a graph showing the dispersion of ancestors across father & mother