قالب:Medical cases chart

Template documentation[view] [edit] [history] [purge]

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

{{Medical cases chart
|float      = on what side of the page should the chart be located (left|right|none)   [optional, defaults to: right] 

|rowheight  = height of each bar, in multiples of the text height                      [optional, defaults to: 1.6]
|divisor    = manual override of the scaling divisor for the width of the bars         [optional, defaults to: auto]
|barwidth   = width of the stacked bars area (thin|medium|wide)                        [optional, defaults to: medium]
|numwidth   = max width of the numbers in the right columns (AA or AAAA)<-(n|t|m|w|x|d)[optional, defaults to: mm,
                                                                                        see below and examples]

|collapsible= whether the rows are collapsible (yes|y|1)                               [optional, defaults to: no]
|duration   = number of rows to display when collapsed                                 [optional, defaults to: 15]
|nooverlap  = Set to "true" to show toggles for specific date ranges, or "false" to    [optional, defaults to: false]
              allow the "Last XX days" toggle to overlap with the month toggles.
              
|pretitle   = text at the beginning of the title                                       [optional]
|disease    = name of the disease
|location   = location of the outbreak the chart is showing
|location2  = broader location such as state/province or country                       [optional]
|location3  = broadest location such as country                                        [optional]
|posttitle  = text at the end of the title                                             [optional]
|outbreak   = name of the main outbreak (for link of the {{navbar}})

|recoveries = display recoveries in the legend (no|n|0)                                [optional, defaults to: yes]

|reclbl     = alternate label for the 2nd case classification                          [optional, defaults to: Recoveries]
|altlbl1    = alternate label for the 3rd case classification                          [optional, defaults to: Cases]
|altlbl2    = alternate label for the 4th case classification                          [optional]
|altlbl3    = alternate label for the 5th case classification                          [optional]

|right1     = heading of the 1st data column                                           [optional, defaults to: # of cases]
|right1data = case classification for the 1st column                                   [optional, defaults to: 3 (if right1 is "# of cases")]
|changetype1= calculate percent change (%) or absolute change (#) (p|a)                [optional, defaults to: percent]
|right2     = heading of the 2nd data column                                           [optional]
|right2data = case classification for the 2nd column                                   [optional, defaults to: 1 (if right2 is "# of deaths")]
|changetype2= calculate percent change (%), absolute change (#), or onlypercent (p|a|o)[optional, defaults to: percent]

|data       = data lines for each valid date (see Data's and Rows' syntax)

|caption    = caption under the chart                                                  [optional]
}}

numwidth 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, mw sets the right1 value column to medium and the right1 change column to wide. mwnt 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 right1data and right2data):

|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=date;deaths;2nd classification (recoveries);3rd classification (total or altlbl1);4th classification #;5th classification #;1st column #;1st column change;2nd column #;2nd column change;other parameters=values
date;deaths;2nd classification (recoveries);3rd classification (total or altlbl1);4th classification #;5th classification #;1st column #;1st column change;2nd column #;2nd column change;other parameters=values
...

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 alttot1. The same applies to the expression for total in 5th classification and alttot2.

The 1st column #, 1st column change, 2nd column #, and 2nd column change values can be automatically calculated if omitted. The 1st column values will be automatically calculated if |right1= is omitted or set to # of cases, and the 2nd column values will be automatically calculated if |right2= is set to # of deaths. 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. 1 for deaths, 2 for recoveries, 3 for total, etc.). The changes in the first and second columns are automatically wrapped in parentheses.

The other parameters=values 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 {{Medical cases chart/Row| 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:

{{Medical cases chart/Row|2020-04-15|1921||28059|||28,059|+1058||+4%|divisor=100|numwidth-mmnm}}

becomes

2020-04-15;1921;;28059;;;28,059;+1058;;+4%

Rows

Deprecated parameter
The rows 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
|1          = ''valid date''                                                               [defaults to: ⋮, in which case
                                                                                           the appropriate changes become (=)]
|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 collapsed and id will have no effect if collapsible 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 alttot1. The same applies to the expression for total in 5th classification and alttot2. The changes in the first and second columns are automatically wrapped in brackets. The divisor should be the same for all rows that can be visible at the same time. numwidth 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.

Examples

{{Medical cases chart
|numwidth=mw

|disease=Green Flu
|location=Savannah|location2=Georgia|location3=United States
|outbreak=2009 Green Flu outbreak

|recoveries=n

|data=
2009-04-13;;;42;;;42;firstright1=y
2009-04-14;;;356;;;356;+748%
2009-04-15;;;1503;;;1,503;+322%
2009-04-16;57;;5915;;;5,915;+294%
2009-04-17;2000;;9500;;;~9,500;+60.6%
}}
Green Flu حالة في Savannah, Georgia, United States  ()
     الوفيات        الحالات النشطة
التاريخ
# الحالات
2009-04-13
42(n.a.)
2009-04-14
356(+748%)
2009-04-15
1,503(+322%)
2009-04-16
5,915(+294%)
2009-04-17
~9,500(+60.6%)
{{Medical cases chart
|barwidth=wide
|numwidth=mwwd

|pretitle=Approximate
|disease=Spanish Flu
|location=the World
|posttitle=(excluding Oceania)
|outbreak=1918-20 Spanish Flu pandemic

|altlbl1=Active confirmed
|altlbl2=Suspected
|altlbl3=Estimated

|right1=Confirmed cases
|right2=Including suspected and estimated cases

|divisor=2550
|data=
1918-03-10;(2060-300);(3000-800);6000;;;6000;firstright1=y
1918-07;12600;20000;40000;12000;;alttot2=(34000-15000-8700+40);40000;+500%;10500;firstright2=y
;12600;20000;40000;12000;;alttot2=(34000-15000-8700+40);40000;;10500
1919;100000;250000;;;1000000;;;1mi;+500k

|caption=Foo Bar
}}
Approximate Spanish Flu حالة في the World (excluding Oceania)  ()
     الوفيات        التعافي        Active confirmed        Suspected        Estimated
التاريخ
Confirmed cases
Including suspected and estimated cases
1918-03-10
6000(n.a.)
1918-07
40000(+500%) 10500(n.a.)
40000(=) 10500(=)
1919
1mi(+500k)
Foo Bar

Applied example

{{2019–20 coronavirus pandemic data/South Korea medical cases chart}}

كوڤيد-19 حالة في كوريا الجنوبية  ()
     الوفيات        التعافي        الحالات النشطة

يناير يناير فبراير فبراير مارس مارس آخر 15 أيام آخر 15 أيام

التاريخ
# الحالات
# الوفيات
2020-01-20
1(n.a.)
1(=)
2020-01-24
2(+100%)
2020-01-25
2(=)
2020-01-26
3(+50%)
2020-01-27
4(+33%)
4(=)
2020-01-30
6(+50%)
2020-01-31
11(+83%)
2020-02-01
12(+9.1%)
2020-02-02
15(+25%)
2020-02-03
15(=)
2020-02-04
16(+6.7%)
2020-02-05
19(+19%)
2020-02-06
23(+21%)
2020-02-07
24(+4.3%)
2020-02-08
24(=)
2020-02-09
27(+13%)
2020-02-10
27(=)
2020-02-11
28(+3.7%)
28(=)
2020-02-16
29(+3.6%)
2020-02-17
30(+3.4%)
2020-02-18
31(+3.3%)
2020-02-19
51(+65%)
2020-02-20
104(+104%) 1(n.a.)
2020-02-21
204(+96%) 2(+100%)
2020-02-22
433(+112%) 2(=)
2020-02-23
602(+39%) 4(+100%)
2020-02-24
833(+38%) 7(+75%)
2020-02-25
977(+17%) 10(+43%)
2020-02-26
1,261(+29%) 12(+20%)
2020-02-27
1,766(+40%) 13(+8.3%)
2020-02-28
2,337(+32%) 13(=)
2020-02-29
3,150(+35%) 17(+31%)
2020-03-01
4,212(+34%) 22(+29%)
2020-03-02
4,812(+14%) 28(+27%)
2020-03-03
5,328(+11%) 32(+14%)
2020-03-04
5,766(+8.2%) 35(+9.4%)
2020-03-05
6,284(+9.0%) 42(+20%)
2020-03-06
6,767(+7.7%) 44(+4.8%)
2020-03-07
7,134(+5.4%) 50(+14%)
2020-03-08
7,382(+3.5%) 51(+2.0%)
2020-03-09
7,513(+1.8%) 54(+5.9%)
2020-03-10
7,755(+3.2%) 60(+11%)
2020-03-11
7,869(+1.5%) 66(+10%)
2020-03-12
7,979(+1.4%) 67(+1.5%)
2020-03-13
8,086(+1.3%) 72(+7.4%)
2020-03-14
8,162(+0.94%) 75(+4.2%)
2020-03-15
8,236(+0.90%) 75(=)
2020-03-16
8,320(+1.0%) 81(+8.0%)
2020-03-17
8,413(+1.1%) 84(+3.7%)
2020-03-18
8,565(+1.8%) 91(+8.3%)
2020-03-19
8,652(+1.0%) 94(+3.3%)
2020-03-20
8,799(+1.7%) 102(+8.5%)
2020-03-21
8,897(+1.1%) 104(+2.0%)
2020-03-22
8,961(+0.72%) 111(+6.7%)
2020-03-23
9,037(+0.85%) 120(+8.1%)
2020-03-24
9,137(+1.1%) 126(+5.0%)
2020-03-25
9,241(+1.1%) 131(+4.0%)
2020-03-26
9,332(+0.98%) 139(+6.1%)
2020-03-27
9,478(+1.6%) 144(+3.6%)
2020-03-28
9,583(+1.1%) 152(+5.6%)
2020-03-29
9,661(+0.81%) 158(+3.9%)
2020-03-30
9,786(+1.3%) 162(+2.5%)
2020-03-31
9,887(+1.0%) 165(+1.9%)
2020-04-01
9,976(+0.90%) 169(+2.4%)
2020-04-02
10,062(+0.86%) 174(+3.0%)
2020-04-03
10,156(+0.93%) 177(+1.7%)
2020-04-04
10,237(+0.80%) 183(+3.4%)
2020-04-05
10,284(+0.46%) 186(+1.6%)
2020-04-06
10,331(+0.46%) 192(+3.2%)
2020-04-07
10,384(+0.51%) 200(+4.2%)
2020-04-08
10,423(+0.38%) 204(+2.0%)
2020-04-09
10,450(+0.26%) 208(+2.0%)
2020-04-10
10,480(+0.29%) 211(+1.4%)
2020-04-11
10,512(+0.31%) 214(+1.4%)
2020-04-12
10,537(+0.24%) 217(+1.4%)
2020-04-13
10,564(+0.26%) 222(+2.3%)
2020-04-14
10,591(+0.26%) 225(+1.4%)
2020-04-15
10,613(+0.21%) 229(+1.8%)
2020-04-16
10,635(+0.21%) 230(+0.44%)
مصدر البيانات KCDC؛ انظر أيضاً: إحصائيات تفصيلية للمصادر.

TemplateData

Produces charts based on {{Bar box}} for outbreak, epidemic and pandemic medical cases.

وسائط القالب

وسيطوصفنوعحالة
Diseasedisease

name of the disease

نصمطلوب
Outbreakoutbreak

name of the main outbreak (for link of the {{navbar}})

نصمطلوب
Locationlocation

location of the outbreak the chart is showing

نصمطلوب
Datadata

data lines for each valid date (see Data's and Rows' syntax)

قيمة تلقائية
غير معروفمطلوب
Pretitlepretitle

text at the beginning of the title

قيمة تلقائية
غير معروفاختياري
Bar widthbarwidth

width of the stacked bars area (thin|medium|wide)

قيمة تلقائية
medium
غير معروفاختياري
Number widthnumwidth

max width of the numbers in the right columns (xx or xxxx)<-(n|t|m|w|d)

قيمة تلقائية
mm
غير معروفاختياري
Floatfloat

on what side of the page should the chart be located (left|right|none)

قيمة تلقائية
right
نصاختياري
Location 2location2

broader location such as state/province or country

نصاختياري
Location 3location3

broadest location such as country

نصاختياري
Post-titleposttitle

text at the end of the title

غير معروفاختياري
Recoveriesrecoveries

display recoveries in the legend (no|n|0)

غير معروفاختياري
Recoveries labelreclbl

alternate label for the recoveries classification

غير معروفاختياري
Alt label 1altlbl1

alternate label for the 3rd case classification

غير معروفاختياري
Alt label 2altlbl2

alternate label for the 4th case classification

قيمة تلقائية
Cases
غير معروفاختياري
Alt label 3altlbl3

alternate label for the 5th case classification

غير معروفاختياري
Toggles bartogglesbar

HTML of the toggles bar to show/hide rows

غير معروفاختياري
Right 1right1

heading of the first data column

قيمة تلقائية
# of cases
غير معروفاختياري
Right 2right2

heading of the second data column

نصاختياري
rowsrows

دون وصف

غير معروفاختياري
Divisordivisor

manual override of the scaling divisor of the bars

قيمة تلقائية
auto
غير معروفاختياري
Collapsiblecollapsible

whether the rows are collapsible (yes|y|1)

غير معروفاختياري
Captioncaption

caption under the chart

غير معروفاختياري