Code Duplication    Length = 54-54 lines in 2 locations

statisticsplot.php 2 locations

@@ 967-1020 (lines=54) @@
964
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
965
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
966
	break;
967
case '13':
968
	$monthdata = array();
969
	for ($i = 0; $i < 12; ++$i) {
970
		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
971
	}
972
973
	if ($z_axis === 301) {
974
		$z_axis = 300;
975
	}
976
	$xgiven            = true;
977
	$zgiven            = false;
978
	$title             = I18N::translate('Month of marriage');
979
	$xtitle            = I18N::translate('month');
980
	$ytitle            = I18N::translate('numbers');
981
	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
982
	$xdata             = $monthdata;
983
	$xmax              = 12;
984
	if ($z_axis !== 300 && $z_axis !== 301) {
985
		calculate_legend($boundaries_z_axis);
986
	}
987
	$percentage = false;
988
	if ($y_axis === 201) {
989
		$percentage = false;
990
		$ytitle     = I18N::translate('Families');
991
	} elseif ($y_axis === 202) {
992
		$percentage = true;
993
		$ytitle     = I18N::translate('percentage');
994
	}
995
	$male_female = false;
996
	if ($z_axis === 300) {
997
		$zgiven          = false;
998
		$legend[0]       = 'all';
999
		$zmax            = 1;
1000
		$z_boundaries[0] = 100000;
1001
	} elseif ($z_axis === 301) {
1002
		$male_female = true;
1003
		$zgiven      = true;
1004
		$legend[0]   = I18N::translate('Male');
1005
		$legend[1]   = I18N::translate('Female');
1006
		$zmax        = 2;
1007
		$xtitle      = $xtitle . I18N::translate(' per gender');
1008
	} elseif ($z_axis === 302) {
1009
		$xtitle = $xtitle . I18N::translate(' per time period');
1010
	}
1011
	//-- reset the data array
1012
	for ($i = 0; $i < $zmax; $i++) {
1013
		for ($j = 0; $j < $xmax; $j++) {
1014
			$ydata[$i][$j] = 0;
1015
		}
1016
	}
1017
	$total = month_of_marriage($z_axis, $z_boundaries, $stats);
1018
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies();
1019
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1020
	break;
1021
case '14':
1022
	$monthdata = array();
1023
	for ($i = 0; $i < 12; ++$i) {
@@ 1071-1124 (lines=54) @@
1068
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies();
1069
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1070
	break;
1071
case '15':
1072
	$monthdata = array();
1073
	for ($i = 0; $i < 12; ++$i) {
1074
		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1075
	}
1076
1077
	if ($z_axis === 301) {
1078
		$z_axis = 300;
1079
	}
1080
	$xgiven            = true;
1081
	$zgiven            = false;
1082
	$title             = I18N::translate('Month of first marriage');
1083
	$xtitle            = I18N::translate('month');
1084
	$ytitle            = I18N::translate('numbers');
1085
	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1086
	$xdata             = $monthdata;
1087
	$xmax              = 12;
1088
	if ($z_axis !== 300 && $z_axis !== 301) {
1089
		calculate_legend($boundaries_z_axis);
1090
	}
1091
	$percentage = false;
1092
	if ($y_axis === 201) {
1093
		$percentage = false;
1094
		$ytitle     = I18N::translate('Families');
1095
	} elseif ($y_axis === 202) {
1096
		$percentage = true;
1097
		$ytitle     = I18N::translate('percentage');
1098
	}
1099
	$male_female = false;
1100
	if ($z_axis === 300) {
1101
		$zgiven          = false;
1102
		$legend[0]       = 'all';
1103
		$zmax            = 1;
1104
		$z_boundaries[0] = 100000;
1105
	} elseif ($z_axis === 301) {
1106
		$male_female = true;
1107
		$zgiven      = true;
1108
		$legend[0]   = I18N::translate('Male');
1109
		$legend[1]   = I18N::translate('Female');
1110
		$zmax        = 2;
1111
		$xtitle      = $xtitle . I18N::translate(' per gender');
1112
	} elseif ($z_axis === 302) {
1113
		$xtitle = $xtitle . I18N::translate(' per time period');
1114
	}
1115
	//-- reset the data array
1116
	for ($i = 0; $i < $zmax; $i++) {
1117
		for ($j = 0; $j < $xmax; $j++) {
1118
			$ydata[$i][$j] = 0;
1119
		}
1120
	}
1121
	$total = month_of_first_marriage($z_axis, $z_boundaries, $stats);
1122
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies();
1123
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1124
	break;
1125
case '17':
1126
	$monthdata = array();
1127
	for ($i = 0; $i < 12; ++$i) {