<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>Modul:Population pyramid - Oʻzgarishlar tarixi</title>
		<link>https://ziyosfera.uz/index.php?title=Modul:Population_pyramid&amp;action=history</link>
		<description>Ziyosferadagi mazkur sahifaning oʻzgarishlar tarixi</description>
		<language>uz</language>
		<generator>MediaWiki 1.45.1</generator>
		<lastBuildDate>Thu, 19 Nov 2026 21:27:25 GMT</lastBuildDate>
		<item>
			<title>Admin 22:13, 2026-yil 14-oktyabr da</title>
			<link>https://ziyosfera.uz/index.php?title=Modul:Population_pyramid&amp;diff=1473822&amp;oldid=prev</link>
			<guid isPermaLink="false">https://ziyosfera.uz/index.php?title=Modul:Population_pyramid&amp;diff=1473822&amp;oldid=prev</guid>
			<description>&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Yangi sahifa&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--&lt;br /&gt;
-- This module implements {{Population pyramid}}&lt;br /&gt;
--&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function get_values(val, total, rescale_flag)&lt;br /&gt;
	if ( rescale_flag ) then&lt;br /&gt;
		total =  (total &amp;gt; 0) and total or 1&lt;br /&gt;
		val = 100*(tonumber(val))/total&lt;br /&gt;
		local val_text = mw.ustring.format(&amp;#039;%.2f&amp;#039;, val)&lt;br /&gt;
		return val, val_text&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return (tonumber(val or &amp;#039;0&amp;#039;) or 0), (val or &amp;#039;n/d&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- this is the main function&lt;br /&gt;
function p.box(frame)&lt;br /&gt;
	local mArguments = require(&amp;#039;Module:Arguments&amp;#039;)&lt;br /&gt;
	local args = mArguments.getArgs(frame)&lt;br /&gt;
&lt;br /&gt;
	-- create a sorted table of ages&lt;br /&gt;
	local ages = {}&lt;br /&gt;
	local max_pop, total_m, total_f = 0, 0, 0&lt;br /&gt;
	for k, v in pairs( args ) do&lt;br /&gt;
		local i = tonumber(tostring(k):match( &amp;#039;^%s*[mf]([%d]+)%s*$&amp;#039; ) or &amp;#039;-1&amp;#039;)&lt;br /&gt;
		local mf = tostring(k):match( &amp;#039;^%s*([mf])[%d]+%s*$&amp;#039; ) or &amp;#039;&amp;#039;&lt;br /&gt;
		if ( i &amp;gt;= 0 and v ) then&lt;br /&gt;
			table.insert(ages, i)&lt;br /&gt;
			if ((tonumber(v) or 0) &amp;gt; max_pop) then&lt;br /&gt;
				max_pop = tonumber(v)&lt;br /&gt;
			end&lt;br /&gt;
			if ( mf == &amp;#039;m&amp;#039; ) then&lt;br /&gt;
				total_m = total_m + (tonumber(v) or 0)&lt;br /&gt;
			elseif (mf == &amp;#039;f&amp;#039;) then&lt;br /&gt;
				total_f = total_f + (tonumber(v) or 0)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	table.sort(ages)&lt;br /&gt;
&lt;br /&gt;
	-- remove duplicates&lt;br /&gt;
	for k = 2,#ages do&lt;br /&gt;
		if ages[k] == ages[k-1] then&lt;br /&gt;
			table.remove(ages, k)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- compute the bar width&lt;br /&gt;
	local mmax = tonumber(args[&amp;#039;mmax&amp;#039;] or &amp;#039;9&amp;#039;) or 9&lt;br /&gt;
	if ( (args[&amp;#039;mmax&amp;#039;] or &amp;#039;&amp;#039;) == &amp;#039;auto&amp;#039; and (max_pop &amp;gt; 0) ) then&lt;br /&gt;
		mmax = max_pop&lt;br /&gt;
	end&lt;br /&gt;
	local scale = tonumber(args[&amp;#039;scale&amp;#039;] or &amp;#039;10&amp;#039;) or 10&lt;br /&gt;
	local barmaxpx = mmax*scale&lt;br /&gt;
&lt;br /&gt;
	local percent = ((args[&amp;#039;percentage&amp;#039;] or &amp;#039;&amp;#039;) == &amp;#039;off&amp;#039;) and &amp;#039;#&amp;#039; or &amp;#039;%&amp;#039;&lt;br /&gt;
	local rescale_values = ((args[&amp;#039;percentage&amp;#039;] or &amp;#039;&amp;#039;) == &amp;#039;auto&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	-- create the inner table&lt;br /&gt;
	local root = mw.html.create(&amp;#039;table&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;width&amp;#039;, &amp;#039;100%&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;margin&amp;#039;, &amp;#039;0&amp;#039;)&lt;br /&gt;
	-- table header row&lt;br /&gt;
	local row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
	row:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;font-weight&amp;#039;, &amp;#039;normal&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;text-align&amp;#039;, &amp;#039;right&amp;#039;)&lt;br /&gt;
		:wikitext(percent)&lt;br /&gt;
	row:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;text-align&amp;#039;, &amp;#039;left&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;font-weight&amp;#039;, &amp;#039;normal&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;width&amp;#039;, barmaxpx .. &amp;#039;px&amp;#039;)&lt;br /&gt;
		:wikitext(&amp;#039;Males&amp;#039;)&lt;br /&gt;
	row:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;font-weight&amp;#039;, &amp;#039;normal&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;text-align&amp;#039;, &amp;#039;center&amp;#039;)&lt;br /&gt;
		:wikitext(&amp;#039;Age&amp;#039;)&lt;br /&gt;
	row:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;font-weight&amp;#039;, &amp;#039;normal&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;text-align&amp;#039;, &amp;#039;right&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;width&amp;#039;, barmaxpx .. &amp;#039;px&amp;#039;)&lt;br /&gt;
		:wikitext(&amp;#039;Females&amp;#039;)&lt;br /&gt;
	row:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;font-weight&amp;#039;, &amp;#039;normal&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;text-align&amp;#039;, &amp;#039;left&amp;#039;)&lt;br /&gt;
		:wikitext(percent)&lt;br /&gt;
&lt;br /&gt;
	-- build the table starting from highest age group&lt;br /&gt;
	local prev_age = -1&lt;br /&gt;
	for k = #ages,1,-1 do&lt;br /&gt;
		local age = ages[k]&lt;br /&gt;
		local age_group = age .. &amp;#039;+&amp;#039;&lt;br /&gt;
		if (prev_age &amp;gt; 0) then&lt;br /&gt;
			age_group = age .. &amp;#039;–&amp;#039; .. (prev_age - 1)&lt;br /&gt;
		end&lt;br /&gt;
		local m, m_text = get_values(args[&amp;#039;m&amp;#039; .. age], total_m, rescale_values)&lt;br /&gt;
		local f, f_text = get_values(args[&amp;#039;f&amp;#039; .. age], total_f, rescale_values)&lt;br /&gt;
		row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;font-size&amp;#039;, &amp;#039;x-small&amp;#039;)&lt;br /&gt;
			:wikitext(m_text)&lt;br /&gt;
		row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;text-align&amp;#039;,&amp;#039;right&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;border-left&amp;#039;, &amp;#039;solid 1px silver&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;border-right&amp;#039;, &amp;#039;solid 1px silver&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;background&amp;#039;, &amp;#039;lightblue&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;overflow&amp;#039;, &amp;#039;hidden&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;margin-left&amp;#039;, &amp;#039;auto&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;width&amp;#039;, (m * scale) .. &amp;#039;px&amp;#039;)&lt;br /&gt;
				:wikitext(&amp;#039;&amp;amp;nbsp;&amp;#039;)&lt;br /&gt;
		row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;font-size&amp;#039;, &amp;#039;x-small&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;text-align&amp;#039;, &amp;#039;center&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;white-space&amp;#039;, &amp;#039;nowrap&amp;#039;)&lt;br /&gt;
			:wikitext(age_group)&lt;br /&gt;
		row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;text-align&amp;#039;,&amp;#039;left&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;border-left&amp;#039;, &amp;#039;solid 1px silver&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;border-right&amp;#039;, &amp;#039;solid 1px silver&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;background&amp;#039;, &amp;#039;pink&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;overflow&amp;#039;, &amp;#039;hidden&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;width&amp;#039;, (f * scale) .. &amp;#039;px&amp;#039;)&lt;br /&gt;
				:wikitext(&amp;#039;&amp;amp;nbsp;&amp;#039;)&lt;br /&gt;
		row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;font-size&amp;#039;, &amp;#039;x-small&amp;#039;)&lt;br /&gt;
			:wikitext(f_text)&lt;br /&gt;
		prev_age = age&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- wrap the table in an infobox&lt;br /&gt;
	local year = args[&amp;#039;year&amp;#039;] and &amp;#039; &amp;lt;span style=&amp;quot;font-weight:normal&amp;quot;&amp;gt;&amp;#039; .. args[&amp;#039;year&amp;#039;] .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039; or &amp;#039;&amp;#039; &lt;br /&gt;
	local below&lt;br /&gt;
	if (args[&amp;#039;source&amp;#039;] or args[&amp;#039;sourceref&amp;#039;]) then&lt;br /&gt;
		below = &amp;#039;\&amp;#039;\&amp;#039;\&amp;#039;Source:\&amp;#039;\&amp;#039;\&amp;#039; &amp;#039;&lt;br /&gt;
		if args[&amp;#039;source&amp;#039;] then&lt;br /&gt;
			below = below .. args[&amp;#039;source&amp;#039;]&lt;br /&gt;
		end&lt;br /&gt;
		if args[&amp;#039;sourceref&amp;#039;] then&lt;br /&gt;
			below = below .. frame:extensionTag( {name=&amp;#039;ref&amp;#039;, content = args[&amp;#039;sourceref&amp;#039;]} )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local infobox = require (&amp;#039;Module:Infobox&amp;#039;).infobox&lt;br /&gt;
	return infobox({&lt;br /&gt;
		[&amp;#039;abovestyle&amp;#039;] = &amp;#039;text-align:center; font-size:100%; border-bottom:solid 1px silver;&amp;#039;,&lt;br /&gt;
		[&amp;#039;above&amp;#039;] = &amp;#039;[[Population pyramid]]&amp;#039; .. year,&lt;br /&gt;
		[&amp;#039;datastyle&amp;#039;] = &amp;#039;padding:0;&amp;#039;,&lt;br /&gt;
		[&amp;#039;belowstyle&amp;#039;] = below and &amp;#039;text-align:left; font-weight:normal; font-size:100%; border-top:solid 1px silver;&amp;#039;,&lt;br /&gt;
		[&amp;#039;below&amp;#039;] = below,&lt;br /&gt;
		[&amp;#039;data1&amp;#039;] = tostring(root)&lt;br /&gt;
	})&lt;br /&gt;
	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</description>
			<pubDate>Wed, 14 Oct 2026 22:13:14 GMT</pubDate>
			<dc:creator>Admin</dc:creator>
			<comments>https://ziyosfera.uz/ziyo/Modul_munozarasi:Population_pyramid</comments>
		</item>
</channel></rss>