/**
 * Documentation: Limited functionality replacement for the dead legacy Google chart API
 *
 * The companion file charts.php is the program that generates various charts when it is launched from 
 * the running PhpGedView.
 *
 * phpGedView: Genealogy Viewer
 * Copyright (C) 2026  David Smart and the PGV Development Team.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * @package PhpGedView
 * @subpackage Charts
 * @author David Smart
 * @version $Id: chart.txt 7389 2026-08-23 21:23:45Z canajun2eh $
 */
/**
 * Legacy Google Chart API-style Chart Generator
 * ---------------------------------------------
 * Supports:
 *	- Pie charts (cht=p)
 *	- Vertical bar charts (cht=bvg)
 *  - Map (cht=t combined with chtm=<region>)
 
 * .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  
 *
 * PARAMETERS
 * ----------
 * cht  (Chart Type)
 *	- 'p'	: Pie chart
 *	- 'bvg' : Vertical bar chart
 *  - 'bvs' : Another vertical barchart. Format not as well understood
 *  - 't'	: Text charge of some form
 *  - 'bhs', 'v', 'rs', 's', 'gom', 'qr' - others, not supported
 *
 * chs  (Chart Size)
 *	- Format: WIDTHxHEIGHT
 *	- Example: chs=440x125
 *
 * chd  (Chart Data)
 *	- Optional numeric override.
 *  - Format: <type>:<value list>
 *	  t:  Text encoding (comma-separated values)
 *	  s:  Simple encoding (single-character encoding)
 *	  e:  Extended encoding (more precise, two-character mime encoding: AZ, az, 09, -, .)
 *	- Example: chd=x:10,20,30
 *
 * chco (Chart Colors)
 *	- Format: chco=<background>,<font>,<series1>,<series2>,...
 *	  - First color : background
 *	  - Second color : font
 *	  - Remaining colors : slice or bar colors
 *	- Example: chco=ffffff,000000,ff0000,00ff00,0000ff
 *
 * chl  (Chart Labels)
 *	- Format: <label> '|' <label> ...
 *			label: <name> - <value>|<name> - <value>|...
 *	- Example: chl=Alpha - 10|Beta - 20|Gamma - 30
 *
 * chtt (Chart Title)
 *	- Format: <title text>
 *	- Example: chtt=Average age at death
 *
 * chf  (Chart Fill)
 *	- Format: chf=bg,<type>,<color1>[,<color2>]
 *	  - bg : background target
 *	  - type : s (solid) or lg (linear gradient)
 *	- Example: chf=bg,lg,efefef,ffffff
 *
 * chxl (Axis Labels)
 *	- Format:
 *		0:|<'|' separated list of x-axis labels>|
 *		1:||<x-axis title>|
 *		2:|<'|' separated list of y-axis labels>|
 *		3:||<y-axis title>|
 *	- Example: chxl=0:|15th|16th|17th|18th|19th|20th|21st|1:||century|2:|0|10|20|30|40|50|60|70|80|90|100|3:||Age|
 *
 * chdl (Legend text)
 *  - Format: <'|' separated list of legend items>
 *  - Example: chdl=Male|Female|Average%20age%20at%20death 
 *
 * chtm (map)
 *  - Format: <map name>
 *  - Example: chtm=world
 *
 * chbh (bar width and spacing)
 *  - Format: chbh=a,b,c
 *		a = bar width
 *		b = bar spacing
 *		c = group spacing
 *  - Example: chbh=3,2,2
 *
 * IGNORED PARAMETERS
 * ------------------
 * chdlp (Legend Position)
 *  - Format: b (bottom), r (right)
 * chls (Line and Bar Styles)
 * chm 
 *	- Example: chm=D,FF0000,2,0,3,1|N*f1*,000000,0,-1,11,1|N*f1*,000000,1,-1,11,1
 * chp (Pie chart rotation angle)
 * chdls (Slice label styles)
 * chld (Error correction level and margin)
 * chxt (Which axes to display (x - horz, y - vert, r - right, t - top), data from chxl)
 * chxr (Axis ranges - min/max values)
 * chg (Chart Gridlines)
 *  - Format: chg=<x_step>,<y_step>,<line_length>,<blank_length>,<color>
 *            <x_step> - spacing between vertical grid lines (in chart.php? units).
 *            <y_step> - spacing between horizontal grid lines.
 *            <line_length> and <blank_length> - pattern for dashed lines.
 *            <color> - grid line color (hex).
 *  - Example: chg=10,20,1,5,CCCCCC
 *
 * .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  .*  
 *
 * In the following examples, the text "https://yoursite.com/chart_generator" represents a link to your site where the chart generator is located.  Usually this
 * is a sub-directory within your PhpGedView installation.  Notice also that the text "%20" in some examples is the way a space must be represented
 * in the URL.  For readability, these spaces are shown as actual spaces in the "breakout".
 *
 * Example:
 *		https://www.yoursite.com/chart_generator/chart.php?cht=bvs&chs=775x150&chbh=3,2,2&chf=bg,s,FFFFFF99&chco=0000FF,FFA0CB,FF0000&chdl=Males|Females|Average%20age:%2062&chtt=Age+at+death&chxt=x,y,r&chm=V,FF0000,0,61.7,1&chxl=0:|0|||||5|||||10|||||15|||||20|||||25|||||30|||||35|||||40|||||45|||||50|||||55|||||60|||||65|||||70|||||75|||||80|||||85|||||90|||||95||||||1:||3%20%|2:||2|4|6|8|10|12|14|16|17%20/%20552&chg=100,11.8,1,5&chd=s:KOADADAADDADADDDAHHDKAAHKHRAAHRADDHDKHRDHHAHAAKHDOOHKHKHOKHVKDROZggOZZVgRVjVKnZgZROggOORODKDHHDDR,cAOHADDAAADAADAHAADDKDHADDDRHDRDHHKHDHHAHAKDHHAHDAHHAAKDHKKRRRRADKOHVRODcVRKDVROOjRVVOcVVHKOHDKHc
 * This breaks out to:
 *		https://www.yoursite.com/chart_generator/chart.php?cht=bvs
 *			&chs=775x150
 *			&chbh=3,2,2
 *			&chf=bg,s,FFFFFF99
 *			&chco=0000FF,FFA0CB,FF0000
 *			&chdl=Males|Females|Average age: 62
 *			&chtt=Age+at+death
 *			&chxt=x,y,r
 *			&chm=V,FF0000,0,61.7,1
 *			&chxl=
 *				0:|0|||||5|||||10|||||15|||||20|||||25|||||30|||||35|||||40|||||45|||||50|||||55|||||60|||||65|||||70|||||75|||||80|||||85|||||90|||||95||||||
 *				1:||3 %|
 *				2:||2|4|6|8|10|12|14|16|17 / 552
 *			&chg=100,11.8,1,5
 *			&chd=s:
 *				KOADADAADDADADDDAHHDKAAHKHRAAHRADDHDKHRDHHAHAAKHDOOHKHKHOKHVKDROZggOZZVgRVjVKnZgZROggOORODKDHHDDR,
 *				cAOHADDAAADAADAHAADDKDHADDDRHDRDHHKHDHHAHAKDHHAHDAHHAAKDHKKRRRRADKOHVRODcVRKDVROOjRVVOcVVHKOHDKHc
 *
 *
 * Example:
 *		https://yoursite.com/chart_generator/chart.php?cht=bvs&chs=775x150&chbh=3,2,2&chf=bg,s,FFFFFF99&chco=0000FF,FFA0CB,FF0000&chdl=Males|Females|Average%20age:%2077&chtt=Age+at+death&chxt=x,y,r&chm=V,FF0000,0,76.7,1&chxl=0:|0|||||5|||||10|||||15|||||20|||||25|||||30|||||35|||||40|||||45|||||50|||||55|||||60|||||65|||||70|||||75|||||80|||||85|||||90|||||95||||||1:||17%20%|2:||1|2%20/%2012&chg=100,50,1,5&chd=s:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeAAAAAAAAAAAAAAAAAAAAAeAeAAAAAAeAAAeAAAAAAAAAAAAAAeAAAAAAAA,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeAAeAAeAeAeAeAA
 * This breaks out to:
 *		https://yoursite.com/chart_generator/chart.php?cht=bvs
 *			&chs=775x150
 *			&chbh=3,2,2
 *			&chf=bg,s,FFFFFF99
 *			&chco=0000FF,FFA0CB,FF0000
 *			&chdl=Males|Females|Average age: 77
 *			&chtt=Age+at+death
 *			&chxt=x,y,r
 *			&chm=V,FF0000,0,76.7,1
 *			&chxl=
 *				0:|0|||||5|||||10|||||15|||||20|||||25|||||30|||||35|||||40|||||45|||||50|||||55|||||60|||||65|||||70|||||75|||||80|||||85|||||90|||||95||||||
 *				1:||17 %|
 *				2:||1|2 / 12
 *			&chg=100,50,1,5
 *			&chd=s:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeAAAAAAAAAAAAAAAAAAAAAeAeAAAAAAeAAAeAAAAAAAAAAAAAAeAAAAAAAA
 *				,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeAAeAAeAeAeAeAA
 *
 *
 * Example:
 *		https://yoursite.com/chart_generator/chart.php?cht=p3&chd=e:ABAFANAQAoAXAD&chs=440x125&chco=ffffff,9ca3d4&chf=bg,s,ffffff00&chl=15th%20-%205|16th%20-%2041|17th%20-%20106|18th%20-%20133|19th%20-%20339|20th%20-%20196|21st%20-%2023
 * This breaks out to:
 *		https://yoursite.com/chart_generator/chart?cht=p3
 *			&chd=e:ABAFANAQAoAXAD
 *			&chs=440x125
 *			&chco=ffffff,9ca3d4
 *			&chf=bg,s,ffffff00
 *			&chl=15th - 5|16th - 41|17th - 106|18th - 133|19th - 339|20th - 196|21st - 23
 *
 *
 * Example:
 *		https://yoursite.com/chart_generator/chart.php?cht=p3&chd=e:AbBI&chs=440x125&chco=ffffff,cccccc&chf=bg,s,ffffff00&chl=Living%20-%2027.7%|Dead%20-%2072.3%|
 * This breaks out to:
 *		https://yoursite.com/chart_generator/chart?cht=p3
 *			&chd=e:AbBI
 *			&chs=440x125
 *			&chco=ffffff,cccccc
 *			&chf=bg,s,ffffff00
 *			&chl=Living - 27.7%|Dead - 72.3%|
 *
 *
 * Example:
 *		https://yoursite.com/chart_generator/chart.php?cht=bvg&chs=950x300&chf=bg,s,ffffff00|c,s,ffffff00&chtt=Number%20of%20children|Counts%20%20542%20of%20839&chd=t:80,25,35,5,15,0,0|40,10,5,10,5,0,0|40,10,15,5,5,0,0|5,30,25,5,20,0,0|45,50,30,10,10,5,5|100,55,25,10,0,0,0|50,90,0,5,0,0,0|50,25,0,0,0,0,0&chco=0000FF,FFA0CB,9F00FF,FF7000,905030,FF0000,00FF00,F0F000&chbh=5,1&chxt=x,x,y,y&chxl=0:|less%20than%202|2-4|5-6|7-8|9-10|11-12|over%2012|1:||||children%20per%20time%20period|2:|0|2|4|6|8|10|12|14|16|18|20|3:||Total%20families|&chdl=before%201700|1700-1749|1750-1799|1800-1849|1850-1899|1900-1949|1950-1999|from%202000
 * This breaks out to:
  * 	https://yoursite.com/chart_generator/chart.php?cht=bvg
 *			&chs=950x300
 *			&chf=bg,s,ffffff00|c,s,ffffff00
 *			&chtt=Number of children|Counts  542 of 839
 *			&chd=t:
 *				80,  25, 35,  5, 15, 0, 0 |
 *				40,  10,  5, 10,  5, 0, 0 |
 *				40,  10, 15,  5,  5, 0, 0 |
 *				 5,  30, 25,  5, 20, 0, 0 |
 *				45,  50, 30, 10, 10, 5, 5 |
 *				100, 55, 25, 10,  0, 0, 0 |
 *				50,  90,  0,  5,  0, 0, 0 |
 *				50,  25,  0,  0,  0, 0, 0
 *			&chco=0000FF,FFA0CB,9F00FF,FF7000,905030,FF0000,00FF00,F0F000
 *			&chbh=5,1
 *			&chxt=x,x,y,y
 *			&chxl=
 *				0:|less than 2|2-4|5-6|7-8|9-10|11-12|over 12|
 *				1:||||children per time period|
 *				2:|0|2|4|6|8|10|12|14|16|18|20|
 *				3:||Total%20families|
 *			&chdl=before%201700|1700-1749|1750-1799|1800-1849|1850-1899|1900-1949|1950-1999|from&202000
 *
 *
 * More examples:
 *		https://yoursite.com/chart_generator/chart.php?cht=p3&chd=e:AKAFAEAEADBH&chs=440x125&chco=ffffff,9ca3d4&chf=bg,s,ffffff00&chl=Smart%20-%20115|Longwell%20-%2059|Chamberlin%20-%2044|Baker%20-%2042|Warner%20-%2041|Other%20-%20854
 *
 *
 *		https://yoursite.com/chart_generator/chart.php?cht=bvg&chs=580x250&chm=D,FF0000,2,0,3,1|N*f1*,000000,0,-1,11,1|N*f1*,000000,1,-1,11,1&chf=bg,s,ffffff00|c,s,ffffff00&chtt=Average%20age%20at%20death&chd=t2:50.0,52.5,57.2,55.0,56.2,70.1,73.4|0,51.2,45.6,54.9,59.0,70.7,85.9|50.0,51.9,51.4,55,57.6,70.4,79.7&chco=0000FF,FFA0CB,FF0000&chbh=20,3&chxt=x,x,y,y&chxl=0:|15th|16th|17th|18th|19th|20th|21st|1:||century|2:|0|10|20|30|40|50|60|70|80|90|100|3:||Age|&chdl=Male|Female|Average%20age%20at%20death
 *
 *
 *		https://yoursite.com/chart_generator/chart.php?cht=bvg&chs=448x200&chf=bg,s,ffffff00|c,s,ffffff00&chm=D,FF0000,0,0,3,1|t5.33,000000,0,0,11,1|t2.81,000000,0,1,11,1|t2.76,000000,0,2,11,1|t4.41,000000,0,3,11,1|t1.95,000000,0,4,11,1|t0.80,000000,0,5,11,1&chd=e:iHR.RqcOMeFH&chco=0000FF&chbh=30,3&chxt=x,x,y,y&chxl=0:|16th|17th|18th|19th|20th|21st|1:||century|2:|0|1|2|3|4|5|6|7|8|9|10|3:||Number%20of%20children|
 *
 *
 * Example:
 *		https://yoursite.com/chart_generator/chart.php?cht=bvg&chs=500x250&chm=D,FF0000,2,0,3,1|t25.9,000000,0,0,11,1|t28.9,000000,0,1,11,1|t29.9,000000,0,2,11,1|t29.1,000000,0,3,11,1|t26.2,000000,0,4,11,1|t31.9,000000,0,5,11,1|t20.3,000000,1,0,11,1|t23.6,000000,1,1,11,1|t32.1,000000,1,2,11,1|t22.8,000000,1,3,11,1|t24.5,000000,1,4,11,1|t31.3,000000,1,5,11,1&chf=bg,s,ffffff00|c,s,ffffff00&chtt=Average%20age%20at%20marriage&chd=t2:51.8,57.8,59.8,58.2,52.4,63.8|40.6,47.2,64.2,45.6,49,62.6|46.2,52.5,62,51.9,50.7,63.2&chco=0000FF,FFA0CB,FF0000&chbh=20,3&chxt=x,x,y,y&chxl=0:|16th|17th|18th|19th|20th|21st|1:||century|2:|0|10|20|30|40|50|3:||Age|&chdl=Male|Female|Average%20age
 *	This breaks out to:
 *		https://yoursite.com/chart_generator/chart.php?cht=bvg
 *			&chs=500x250
 *			&chm=D,FF0000,2,0,3,1|
 *				t25.9,000000,0,0,11,1|
 *				t28.9,000000,0,1,11,1|
 *				t29.9,000000,0,2,11,1|
 *				t29.1,000000,0,3,11,1|
 *				t26.2,000000,0,4,11,1|
 *				t31.9,000000,0,5,11,1|
 *				t20.3,000000,1,0,11,1|
 *				t23.6,000000,1,1,11,1|
 *				t32.1,000000,1,2,11,1|
 *				t22.8,000000,1,3,11,1|
 *				t24.5,000000,1,4,11,1|
 *				t31.3,000000,1,5,11,1
 *			&chf=bg,s,ffffff00|c,s,ffffff00
 *			&chtt=Average age at marriage
 *			&chd=t2:
 *				51.8,57.8,59.8,58.2,52.4,63.8|
 *				40.6,47.2,64.2,45.6,49,62.6|
 *				46.2,52.5,62,51.9,50.7,63.2
 *			&chco=0000FF,FFA0CB,FF0000
 *			&chbh=20,3
 *			&chxt=x,x,y,y
 *			&chxl=
 *				0:|16th|17th|18th|19th|20th|21st|
 *				1:||century|
 *				2:|0|10|20|30|40|50|
 *				3:||Age|
 *			&chdl=Male|Female|Average age
 *
 *
 *  Example:
 *		https://yoursite.com/chart_generator/chart.php?cht=bvg&chs=950x300&chf=bg,s,ffffff00|c,s,ffffff00&chtt=Month%20of%20birth|Counts%20%20448%20of%201195&chd=t:50,25,16.7,75,33.3,33.3,8.3,33.3,66.7,58.3,25,41.7|0,16.7,0,8.3,16.7,0,8.3,0,0,25,16.7,25|16.7,50,41.7,41.7,8.3,8.3,25,8.3,16.7,16.7,25,8.3|50,25,58.3,33.3,75,33.3,33.3,33.3,16.7,25,50,58.3|75,75,91.7,100,66.7,100,25,58.3,66.7,91.7,58.3,25|33.3,25,50,66.7,25,83.3,58.3,58.3,58.3,75,41.7,25|66.7,83.3,66.7,91.7,50,83.3,83.3,41.7,41.7,75,58.3,66.7|25,0,8.3,16.7,8.3,25,8.3,8.3,16.7,8.3,8.3,16.7&chco=0000FF,FFA0CB,9F00FF,FF7000,905030,FF0000,00FF00,F0F000&chbh=5,1&chxt=x,x,y,y&chxl=0:|Jan|Feb|March|April|May|June|July|Aug|Sep|Oct|Nov|Dec|1:||||month%20per%20time%20period|2:|0|1|2|4|5|6|7|8|10|11|12|3:||Total%20individuals|&chdl=before%201700|1700-1749|1750-1799|1800-1849|1850-1899|1900-1949|1950-1999|from%202000
 *	This breaks out to:
 *		https://yoursite.com/chart_generator/chart.php?cht=bvg
 *			&chs=950x300
 *			&chf=bg,s,ffffff00|c,s,ffffff00
 *			&chtt=Month of birth|Counts  448 of 1195
 *			&chd=t:
 *				50  , 25,   16.7,  75  , 33.3,  33.3,  8.3, 33.3, 66.7, 58.3, 25  , 41.7 |
 *				 0  , 16.7,  0  ,   8.3, 16.7,   0  ,  8.3,  0,    0,   25  , 16.7, 25   |
 *				16.7, 50,   41.7,  41.7,  8.3,   8.3, 25  ,  8.3, 16.7, 16.7, 25  ,  8.3 |
 *				50  , 25,   58.3,  33.3, 75  ,  33.3, 33.3, 33.3, 16.7, 25  , 50  , 58.3 |
 *				75  , 75,   91.7, 100  , 66.7, 100  , 25  , 58.3, 66.7, 91.7, 58.3, 25   |
 *				33.3, 25,   50,    66.7, 25  ,  83.3, 58.3, 58.3, 58.3, 75  , 41.7, 25   |
 *				66.7, 83.3, 66.7,  91.7, 50  ,  83.3, 83.3, 41.7, 41.7, 75  , 58.3, 66.7 |
 *				25  ,  0,    8.3,  16.7,  8.3,  25  ,  8.3,  8.3, 16.7,  8.3,  8.3, 16.7
 *			&chco=0000FF,FFA0CB,9F00FF,FF7000,905030,FF0000,00FF00,F0F000
 *			&chbh=5,1
 *			&chxt=x,x,y,y
 *			&chxl=
 *				0:|Jan|Feb|March|April|May|June|July|Aug|Sep|Oct|Nov|Dec|
 *				1:||||month per time period|
 *				2:|0|1|2|4|5|6|7|8|10|11|12|
 *				3:||Total individuals|
 *			&chdl=before 1700|1700-1749|1750-1799|1800-1849|1850-1899|1900-1949|1950-1999|from 2000
 *
 *
 *  Example:
 *		https://yoursite.com/chart_generator/chart.php?cht=bvg&chs=950x300&chf=bg,s,ffffff00|c,s,ffffff00&chtt=Month%20of%20death|Counts%20%20316%20of%201195&chd=t:74.1,66.7,59.3,55.6,44.4,59.3,40.7,100,66.7,44.4,92.6,51.9|7.4,3.7,0,3.7,3.7,7.4,0,0,3.7,0,7.4,7.4|3.7,3.7,14.8,11.1,0,3.7,3.7,3.7,0,3.7,11.1,3.7|11.1,3.7,3.7,0,7.4,0,7.4,3.7,3.7,0,0,3.7|7.4,3.7,11.1,11.1,3.7,0,0,0,0,0,3.7,0|3.7,3.7,7.4,0,7.4,3.7,3.7,0,7.4,3.7,0,14.8|18.5,3.7,3.7,0,11.1,7.4,0,0,7.4,0,3.7,3.7|14.8,3.7,14.8,3.7,11.1,14.8,3.7,7.4,7.4,7.4,11.1,7.4&chco=0000FF,FFA0CB,9F00FF,FF7000,905030,FF0000,00FF00,F0F000&chbh=5,1&chxt=x,x,y,y&chxl=0:|Jan|Feb|March|April|May|June|July|Aug|Sep|Oct|Nov|Dec|1:||||month%20per%20time%20period|2:|0|3|5|8|11|14|16|19|22|24|27|3:||Total%20individuals|&chdl=before%201940|1940-1949|1950-1959|1960-1969|1970-1979|1980-1989|1990-1999|from%202000
 *	This breaks out to:
 *		https://yoursite.com/chart_generator/chart.php?cht=bvg
 *			&chs=950x300
 *			&chf=bg,s,ffffff00|c,s,ffffff00
 *			&chtt=Month of death|Counts  316 of 1195
 *			&chd=t:74.1,66.7,59.3,55.6,44.4,59.3,40.7,100,66.7,44.4,92.6,51.9 |
 *				7.4,3.7,0,3.7,3.7,7.4,0,0,3.7,0,7.4,7.4 |
 *				3.7,3.7,14.8,11.1,0,3.7,3.7,3.7,0,3.7,11.1,3.7|
 *				11.1,3.7,3.7,0,7.4,0,7.4,3.7,3.7,0,0,3.7|
 *				7.4,3.7,11.1,11.1,3.7,0,0,0,0,0,3.7,0|
 *				3.7,3.7,7.4,0,7.4,3.7,3.7,0,7.4,3.7,0,14.8|
 *				18.5,3.7,3.7,0,11.1,7.4,0,0,7.4,0,3.7,3.7|
 *				14.8,3.7,14.8,3.7,11.1,14.8,3.7,7.4,7.4,7.4,11.1,7.4
 *			&chco=0000FF,FFA0CB,9F00FF,FF7000,905030,FF0000,00FF00,F0F000
 *			&chbh=5,1
 *			&chxt=x,x,y,y
 *			&chxl=0:|Jan|Feb|March|April|May|June|July|Aug|Sep|Oct|Nov|Dec|1:||||month per time period|2:|0|3|5|8|11|14|16|19|22|24|27|3:||Total individuals|
 *			&chdl=before 1940|1940-1949|1950-1959|1960-1969|1970-1979|1980-1989|1990-1999|from 2000
 *
 *
 *  Example:
 *		https://yoursite.com/chart_generator/chart.php?cht=t&chtm=world&chco=ffffff,e5e6ef,9ca3d4&chf=bg,s,ECF5FF&chs=880x440&chld=USGBDENLDKIECABRFRPH&chd=s:9AAAAAAAAA
 *	This breaks out to:
 *		https://yoursite.com/chart_generator/chart.php?cht=t
 *			&chtm=world
 *			&chco=ffffff,e5e6ef,9ca3d4
 *			&chf=bg,s,ECF5FF
 *			&chs=880x440
 *			&chld=USGBDENLDKIECABRFRPH
 *			&chd=s:9AAAAAAAAA
 *
 *
 *  Example:
 *		https://yoursite.com/chart_generator/chart.php?cht=bvg&chs=448x200&chf=bg,s,ffffff00|c,s,ffffff00&chm=D,FF0000,0,0,3,1|t5.33,000000,0,0,11,1|t2.81,000000,0,1,11,1|t2.76,000000,0,2,11,1|t4.41,000000,0,3,11,1|t1.95,000000,0,4,11,1|t0.80,000000,0,5,11,1&chd=e:iHR.RqcOMeFH&chco=0000FF&chbh=30,3&chxt=x,x,y,y&chxl=0:|16th|17th|18th|19th|20th|21st|1:||century|2:|0|1|2|3|4|5|6|7|8|9|10|3:||Number of children|
 *  This breaks out to:
 *		https://yoursite.com/chart_generator/chart.php?cht=bvg
 *			&chs=448x200
 *			&chf=bg,s,ffffff00|c,s,ffffff00
 *			&chm=D,FF0000,0,0,3,1
 *				|t5.33,000000,0,0,11,1
 *				|t2.81,000000,0,1,11,1
 *				|t2.76,000000,0,2,11,1
 *				|t4.41,000000,0,3,11,1
 *				|t1.95,000000,0,4,11,1
 *				|t0.80,000000,0,5,11,1
 *			&chd=e:iHR.RqcOMeFH
 *			&chco=0000FF
 *			&chbh=30,3
 *			&chxt=x,x,y,y
 *			&chxl=
 *				0:|16th|17th|18th|19th|20th|21st|
 *				1:||century|
 *				2:|0|1|2|3|4|5|6|7|8|9|10|
 *				3:||Number of children|
 *
 *
 *  Example:
 *		https://yoursite.com/chart_generator/chart.php?cht=bvg&chs=500x250&chm=D,FF0000,2,0,3,1|t25.9,000000,0,0,11,1|t28.9,000000,0,1,11,1|t29.9,000000,0,2,11,1|t29.1,000000,0,3,11,1|t26.2,000000,0,4,11,1|t31.9,000000,0,5,11,1|t20.3,000000,1,0,11,1|t23.6,000000,1,1,11,1|t32.1,000000,1,2,11,1|t22.8,000000,1,3,11,1|t24.5,000000,1,4,11,1|t31.3,000000,1,5,11,1&chf=bg,s,ffffff00|c,s,ffffff00&chtt=Average%20age%20at%20marriage&chd=t2:51.8,57.8,59.8,58.2,52.4,63.8|40.6,47.2,64.2,45.6,49,62.6|46.2,52.5,62,51.9,50.7,63.2&chco=0000FF,FFA0CB,FF0000&chbh=20,3&chxt=x,x,y,y&chxl=0:|16th|17th|18th|19th|20th|21st|1:||century|2:|0|10|20|30|40|50|3:||Age|&chdl=Male|Female|Average%20age
 *  This breaks out to:
 *		https://yoursite.com/chart_generator/chart.php?cht=bvg
 *			&chs=500x250
 *			&chm=D,FF0000,2,0,3,1
 *				|t25.9,000000,0,0,11,1
 *				|t28.9,000000,0,1,11,1
 *				|t29.9,000000,0,2,11,1
 *				|t29.1,000000,0,3,11,1
 *				|t26.2,000000,0,4,11,1
 *				|t31.9,000000,0,5,11,1
 *				|t20.3,000000,1,0,11,1
 *				|t23.6,000000,1,1,11,1
 *				|t32.1,000000,1,2,11,1
 *				|t22.8,000000,1,3,11,1
 *				|t24.5,000000,1,4,11,1
 *				|t31.3,000000,1,5,11,1
 *			&chf=bg,s,ffffff00
 *				|c,s,ffffff00
 *			&chtt=Average age at marriage
 *			&chd=t2:
 *				51.8,57.8,59.8,58.2,52.4,63.8 |
 *				40.6,47.2,64.2,45.6,49,62.6  |
 *				46.2,52.5,62,51.9,50.7,63.2
 *			&chco=0000FF,FFA0CB,FF0000
 *			&chbh=20,3
 *			&chxt=x,x,y,y
 *			&chxl=
 *				0:|16th|17th|18th|19th|20th|21st|
 *				1:||century|
 *				2:|0|10|20|30|40|50|
 *				3:||Age|
 *			&chdl=Male|Female|Average age
 *
 *
 *  Example:
 *		https://yoursite.com/chart_generator/chart.php?cht=bvg&chs=580x250&chm=D,FF0000,2,0,3,1|N*f1*,000000,0,-1,11,1|N*f1*,000000,1,-1,11,1&chf=bg,s,ffffff00|c,s,ffffff00&chtt=Average%20age%20at%20death&chd=t2:50.0,52.5,57.2,55.0,56.2,70.1,73.4|54.3,51.2,45.6,54.9,59.0,70.7,85.9|50.0,51.9,51.4,55,57.6,70.4,79.7&chco=0000FF,FFA0CB,FF0000&chbh=20,3&chxt=x,x,y,y&chxl=0:|15th|16th|17th|18th|19th|20th|21st|1:||century|2:|0|10|20|30|40|50|60|70|80|90|100|3:||Age|&chdl=Male|Female|Average age at death
 *  This breaks out to:
 *		https://yoursite.com/chart_generator/chart?cht=bvg
 *			&chs=580x250
 *			&chm=D,FF0000,2,0,3,1|N*f1*,000000,0,-1,11,1|N*f1*,000000,1,-1,11,1
 *			&chf=bg,s,ffffff00|c,s,ffffff00
 *			&chtt=Average age at death
 *			&chd=
 *			  t2:
 *				  50.0, 52.5, 57.2, 55.0, 56.2, 70.1, 73.4 |
 *				  54.3	51.2, 45.6, 54.9, 59.0, 70.7, 85.9 |
 *				  50.0, 51.9, 51.4, 55,	57.6, 70.4, 79.7
 *			&chco=0000FF,FFA0CB,FF0000
 *			&chbh=20,3
 *			&chxt=x,x,y,y
 *			&chxl=
 *			  0:|15th|16th|17th|18th|19th|20th|21st|
 *			  1:||century|
 *			  2:|0|10|20|30|40|50|60|70|80|90|100|
 *			  3:||Age|
 *			&chdl=
 *			  Male|
 *			  Female|
 *			  Average age at death
 *
 *
 * Example:
 *		https://yoursite.com/chart_generator/chart.php?cht=p3&chd=e:AABj&chs=440x125&chco=ffffff,9ca3d4&chf=bg,s,ffffff00&chl=With%20sources%20-%200.6%|Without%20sources%20-%2099.4%
 *	This breaks out to:
 *		https://yoursite.com/chart_generator/chart.php?cht=p3
 *			&chd=e:AABj
 *			&chs=440x125
 *			&chco=ffffff,9ca3d4
 *			&chf=bg,s,ffffff00
 *			&chl=With sources - 0.6%|Without sources - 99.4%
 *
 *
 * Example:
 * 		https://yoursite.com/chart_generator/chart.php?cht=t&chtm=world&chco=ffffff,c3dfff,84beff&chf=bg,s,ECF5FF&chs=840x620&chld=USGBDEPLIECAHUFRNOCZSERUUACHATSIAUINSGBEIDITBRKENLROBSBBBNCOCRDKGEGYKOLVLTMYMTMENIPAPETRVEZW&chd=s:9DhHFEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 * This breaks out to:
 *		https://yoursite.com/chart_generator/chart?cht=t
 *			&chtm=world
 *			&chco=ffffff,c3dfff,84beff
 *			&chf=bg,s,ECF5FF
 *			&chs=440x220
 *			&chld=USGBDEPLIECAHUFRNOCZSERUUACHATSIAUINSGBEIDITBRKENLROBSBBBNCOCRDKGEGYKOLVLTMYMTMENIPAPETRVEZW
 *			&chd=s:9DhHFEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 *
 *
 * Map Example
 *		https://yoursite.com/chart_generator/chart?cht=t&chtm=world&chco=ffffff,e5e6ef,9ca3d4&chf=bg,s,ECF5FF&chs=840x720&chld=USGBDENLDKIECABRFRPH&chd=s:9AAAAAAAAA
 * This breaks out to:
 *		https://yoursite.com/chart_generator/chart?cht=t
 *			&chtm=world
 *			&chco=ffffff,e5e6ef,9ca3d4
 *			&chf=bg,s,ECF5FF
 *			&chs=840x720
 *			&chld=USGBDENLDKIECABRFRPH
 *			&chd=s:9AAAAAAAAA
 */
