Template:Medical cases chart/doc

Description
This template should be used for all outbreak, epidemic and pandemic medical cases charts based on Bar box to maintain consistency. It displays horizontal bars for up to 5 different classifications of cases for each valid date. It also offers two columns to make numbers explicit and to show relative or absolute changes. It is designed to be flexible, but still standardizes some parts of the chart. This template should be transcluded in other templates, NOT in article pages. Please do not use templates other than Medical cases chart and, maybe, Medical cases chart/Row to get away with a custom formatting. Suggest features in the talk page or code it yourself if it's not controversial.

Usage
is a sequence of the initials of none, thin, medium, wide, extra wide and default, and it determines the maximum width of each number in the data columns. Therefore, one should be chosen that minimizes the total width, but which doesn't make the numbers break/wrap on mobile view. Using 2 or 4 characters allocates one or two data columns, respectively. For example,  sets the right1 value column to medium and the right1 change column to wide. sets the right1 value column to medium, the right1 change column to wide, the right2 value column to none, and the right2 change column to thin.

To display absolute change in the first column and percent change in the second column, set the following (AA represents any two characters, # represents the classification number you are showing, which should be the same for  and  ):

|numwidth = AAnw |right1data = # |changetype1 = a |right2data = # |changetype2 = o

Data
The data parameter should be populated by a sequence of lines with a format similar to the rows'. The difference is that the parameter separator is the semicolon,, and that repetitive parameters, like divisor, numwidth, and collapsible, may be written only once in the body of Medical cases chart. Using data also allows the divisor to be calculated automatically if the parameter is omitted.


 * data=

...

All values are optional, and empty values can be represented by sequential semicolons (e.g. ). Omitting the valid date will treat the row as a date jump, in which no new cases are reported.

The expression for total in the 3rd classification cases has deaths and recoveries automatically subtracted from it. If you want to manually calculate the number in that classification (generally active cases), use. The same applies to the expression for total in 5th classification and.

The,  ,  , and   values can be automatically calculated if omitted. The 1st column values will be automatically calculated if right1 is omitted or set to, and the 2nd column values will be automatically calculated if right2 is set to. If right1 or right2 are set to other values, the columns can still be automatically calculated by setting right1data and right2data to the classification number you want to display in columns 1 and 2, respectively (e.g.  for deaths,   for recoveries,   for total, etc.). The changes in the first and second columns are automatically wrapped in parentheses.

The  can be any number of the parameters below and their values, separated by semicolons. See examples.
 * alttot1   = alternate expression for active cases (3rd classification)
 * alttot2   = alternate expression for number in 5th classification
 * firstright1= whether a change in the first column is not applicable (n.a.) (yes|y|1)
 * firstright2= whether a change in the second column is not applicable (n.a.) (yes|y|1)
 * collapsed = manual override of the initial row state (yes|y|1)                       {WIP}
 * id        = manual override of the row id                                            {WIP}

To convert from the old format, remove  from the beginning and   from the end of the line, replace all pipes (|) with semicolons, and remove any divisor, numwidth, and collapsible parameters from the end (and make sure they are listed in the main template at least once). For example:

becomes

Rows
The  parameter should be populated by a sequence of Medical cases chart/Row. Other bar templates should not be used to keep consistency. The syntax is:

{{Medical cases chart/Row the appropriate changes become (=)]
 * 1         = valid date                                                               [defaults to: ⋮, in which case
 * 2         = expression for deaths
 * 3         = expression for recoveries
 * 4         = expression for total cases (3rd classification)
 * alttot1   = alternate expression for active cases (3rd classification)


 * 5         = expression for number in 4th classification
 * 6         = expression for total in 5th classification
 * alttot2   = alternate expression for number in 5th classification


 * 7         = number in the first column
 * 8         = change in the first column
 * firstright1= whether a change in the first column is not applicable (n.a.) (yes|y|1)


 * 9         = number in the second column
 * 10        = change in the second column
 * firstright2= whether a change in the second column is not applicable (n.a.) (yes|y|1)


 * divisor   = scaling divisor of the bars (bigger value = narrower bars)               [defaults to: 1]
 * numwidth  = max width of the numbers in the right columns (xx or xxxx)<-(n|t|m|w|d)  [defaults to: mm]

}}
 * collapsible= whether the row is collapsible (yes|y|1)                                {WIP}
 * collapsed = manual override of the initial row state (yes|y|1)                       {WIP}
 * id        = manual override of the row id                                            {WIP}

All parameters are optional, although  and   will have no effect if   is not set to true. Omitting the valid date will treat the row as a date jump, in which no new cases are reported. The expression for total cases has deaths and recoveries automatically subtracted from it. If you want to manually calculate the number in that classification (generally active cases), use. The same applies to the expression for total in 5th classification and. The changes in the first and second columns are automatically wrapped in brackets. The  should be the same for all rows that can be visible at the same time. is a sequence of the initials of none, thin, medium, wide and default and it determines the maximum width of each number in the data columns. Therefore, one should be chosen that minimizes the total width, but which doesn't make the numbers break/wrap on mobile view. Using xx or xxxx allocates one or two data columns, respectively.

Applied example
2019–20 coronavirus pandemic data/South Korea medical cases chart

TemplateData
{	"description": "Produces charts based on for outbreak, epidemic and pandemic medical cases.", "params": { "barwidth": { "label": "Bar width", "description": "width of the stacked bars area (thin|medium|wide)", "autovalue": "medium" },		"numwidth": { "label": "Number width", "description": "max width of the numbers in the right columns (xx or xxxx)<-(n|t|m|w|d)", "autovalue": "mm" },		"float": { "label": "Float", "description": "on what side of the page should the chart be located (left|right|none)", "type": "string", "autovalue": "right" },		"pretitle": { "label": "Pretitle", "description": "text at the beginning of the title", "autovalue": "" },		"disease": { "label": "Disease", "description": "name of the disease", "type": "string", "required": true },		"location": { "label": "Location", "description": "location of the outbreak the chart is showing", "type": "string", "required": true },		"location2": { "label": "Location 2", "description": "broader location such as state/province or country", "type": "string" },		"location3": { "label": "Location 3", "description": "broadest location such as country", "type": "string" },		"posttitle": { "label": "Post-title", "description": "text at the end of the title" },		"outbreak": { "label": "Outbreak", "description": "name of the main outbreak (for link of the )", "type": "string", "required": true },		"recoveries": { "label": "Recoveries", "description": "display recoveries in the legend (no|n|0)" },		"reclbl": { "label": "Recoveries label", "description": "alternate label for the recoveries classification" },		"altlbl1": { "label": "Alt label 1", "description": "alternate label for the 3rd case classification" },		"altlbl2": { "label": "Alt label 2", "description": "alternate label for the 4th case classification", "autovalue": "Cases" },		"altlbl3": { "label": "Alt label 3", "description": "alternate label for the 5th case classification" },		"togglesbar": { "label": "Toggles bar", "description": "HTML of the toggles bar to show/hide rows" },		"right1": { "label": "Right 1", "description": "heading of the first data column", "autovalue": "# of cases" },		"right2": { "label": "Right 2", "description": "heading of the second data column", "type": "string" },		"rows": {}, "data": { "label": "Data", "description": "data lines for each valid date (see Data's and Rows' syntax)", "autovalue": "", "required": true },		"divisor": { "label": "Divisor", "description": "manual override of the scaling divisor of the bars", "autovalue": "auto" },		"collapsible": { "label": "Collapsible", "description": "whether the rows are collapsible (yes|y|1)" },		"caption": { "label": "Caption", "description": "caption under the chart" }	},	"paramOrder": [ "disease", "outbreak", "location", "data", "pretitle", "barwidth", "numwidth", "float", "location2", "location3", "posttitle", "recoveries", "reclbl", "altlbl1", "altlbl2", "altlbl3", "togglesbar", "right1", "right2", "rows", "divisor", "collapsible", "caption" ] }