Code Duplication    Length = 46-46 lines in 3 locations

statisticsplot.php 3 locations

@@ 807-852 (lines=46) @@
804
	case '4':
805
		echo $stats->chartDistribution([Filter::get('chart_shows'), 'marriage_distribution_chart']);
806
		break;
807
	case '11':
808
		$monthdata = [];
809
		for ($i = 0; $i < 12; ++$i) {
810
			$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
811
		}
812
		$xgiven            = true;
813
		$zgiven            = false;
814
		$title             = I18N::translate('Month of birth');
815
		$xtitle            = I18N::translate('Month');
816
		$ytitle            = I18N::translate('numbers');
817
		$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
818
		$xdata             = $monthdata;
819
		$xmax              = 12;
820
		if ($z_axis !== 300 && $z_axis !== 301) {
821
			calculate_legend($boundaries_z_axis);
822
		}
823
		$percentage = false;
824
		if ($y_axis === 201) {
825
			$percentage = false;
826
			$ytitle     = I18N::translate('Individuals');
827
		} elseif ($y_axis === 202) {
828
			$percentage = true;
829
			$ytitle     = I18N::translate('percentage');
830
		}
831
		$male_female = false;
832
		if ($z_axis === 300) {
833
			$zgiven          = false;
834
			$legend[0]       = 'all';
835
			$zmax            = 1;
836
			$z_boundaries[0] = 100000;
837
		} elseif ($z_axis === 301) {
838
			$male_female = true;
839
			$zgiven      = true;
840
			$legend[0]   = I18N::translate('Male');
841
			$legend[1]   = I18N::translate('Female');
842
			$zmax        = 2;
843
		}
844
		//-- reset the data array
845
		for ($i = 0; $i < $zmax; $i++) {
846
			for ($j = 0; $j < $xmax; $j++) {
847
				$ydata[$i][$j] = 0;
848
			}
849
		}
850
		$total = month_of_birth($z_axis, $z_boundaries, $stats);
851
		my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
852
		break;
853
	case '12':
854
		$monthdata = [];
855
		for ($i = 0; $i < 12; ++$i) {
@@ 853-898 (lines=46) @@
850
		$total = month_of_birth($z_axis, $z_boundaries, $stats);
851
		my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
852
		break;
853
	case '12':
854
		$monthdata = [];
855
		for ($i = 0; $i < 12; ++$i) {
856
			$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
857
		}
858
		$xgiven            = true;
859
		$zgiven            = false;
860
		$title             = I18N::translate('Month of death');
861
		$xtitle            = I18N::translate('Month');
862
		$ytitle            = I18N::translate('numbers');
863
		$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
864
		$xdata             = $monthdata;
865
		$xmax              = 12;
866
		if ($z_axis !== 300 && $z_axis !== 301) {
867
			calculate_legend($boundaries_z_axis);
868
		}
869
		$percentage = false;
870
		if ($y_axis === 201) {
871
			$percentage = false;
872
			$ytitle     = I18N::translate('Individuals');
873
		} elseif ($y_axis === 202) {
874
			$percentage = true;
875
			$ytitle     = I18N::translate('percentage');
876
		}
877
		$male_female = false;
878
		if ($z_axis === 300) {
879
			$zgiven          = false;
880
			$legend[0]       = 'all';
881
			$zmax            = 1;
882
			$z_boundaries[0] = 100000;
883
		} elseif ($z_axis === 301) {
884
			$male_female = true;
885
			$zgiven      = true;
886
			$legend[0]   = I18N::translate('Male');
887
			$legend[1]   = I18N::translate('Female');
888
			$zmax        = 2;
889
		}
890
		//-- reset the data array
891
		for ($i = 0; $i < $zmax; $i++) {
892
			for ($j = 0; $j < $xmax; $j++) {
893
				$ydata[$i][$j] = 0;
894
			}
895
		}
896
		$total = month_of_death($z_axis, $z_boundaries, $stats);
897
		my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
898
		break;
899
	case '13':
900
		$monthdata = [];
901
		for ($i = 0; $i < 12; ++$i) {
@@ 949-994 (lines=46) @@
946
		$total = month_of_marriage($z_axis, $z_boundaries, $stats);
947
		my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
948
		break;
949
	case '14':
950
		$monthdata = [];
951
		for ($i = 0; $i < 12; ++$i) {
952
			$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
953
		}
954
		$xgiven            = true;
955
		$zgiven            = false;
956
		$title             = I18N::translate('Month of birth of first child in a relation');
957
		$xtitle            = I18N::translate('Month');
958
		$ytitle            = I18N::translate('numbers');
959
		$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
960
		$xdata             = $monthdata;
961
		$xmax              = 12;
962
		if ($z_axis !== 300 && $z_axis !== 301) {
963
			calculate_legend($boundaries_z_axis);
964
		}
965
		$percentage = false;
966
		if ($y_axis === 201) {
967
			$percentage = false;
968
			$ytitle     = I18N::translate('Children');
969
		} elseif ($y_axis === 202) {
970
			$percentage = true;
971
			$ytitle     = I18N::translate('percentage');
972
		}
973
		$male_female = false;
974
		if ($z_axis === 300) {
975
			$zgiven          = false;
976
			$legend[0]       = 'all';
977
			$zmax            = 1;
978
			$z_boundaries[0] = 100000;
979
		} elseif ($z_axis === 301) {
980
			$male_female = true;
981
			$zgiven      = true;
982
			$legend[0]   = I18N::translate('Male');
983
			$legend[1]   = I18N::translate('Female');
984
			$zmax        = 2;
985
		}
986
		//-- reset the data array
987
		for ($i = 0; $i < $zmax; $i++) {
988
			for ($j = 0; $j < $xmax; $j++) {
989
				$ydata[$i][$j] = 0;
990
			}
991
		}
992
		$total = month_of_birth_of_first_child($z_axis, $z_boundaries, $stats);
993
		my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
994
		break;
995
	case '15':
996
		$monthdata = [];
997
		for ($i = 0; $i < 12; ++$i) {