Bản mẫu:Bảng xếp hạng

Bách khoa toàn thư mở Wikipedia
Bước tới điều hướng Bước tới tìm kiếm
Danh sách các thành phố theo dân số
Thành phố Dân số
Tài liệu bản mẫu[xem] [sửa] [lịch sử] [làm mới]

Cách sử dụng[sửa mã nguồn]

Usage and parameters[sửa mã nguồn]

The use of text other than numbers and proper punctuation in a data field will result in an Expression error.
{{Bar chart
| title         = <!-- Title bolded above table; defaults to "List of cities by population" in {bar_chart}. -->
| class         = <!-- Adds a class= parameter after the {| wikitable header -->
| table_width   = <!-- Sets the overall table width in width_units (or em if width_units is not present) -->
| table_style   = <!-- Additional parameters to be added to the table's style parameter -->
| bar_width     = <!-- uses 30 by default. Must be an unformatted number -->
| width_units   = <!-- uses 'em' units by default -->
| label_type    = <!-- Title for the label column; defaults to "City". -->

| label1        = <!-- Row 1 label -->
| label2        = <!-- Row 2 label -->
...
| label25       = <!-- Row 25 label -->

| data_type     = <!-- Title for column 1 data. In {{Bar chart}}, defaults to "Population". -->
| data_max      = <!-- Upper bound on the values in column 1 data fields (uses data1 if not present) -->
| data1         = <!-- Row 1, Column 1 data -->
| comment1      = <!-- Row 1, Column 1 comment -->
| data2         = <!-- Row 2, Column 1 data -->
| comment2      = <!-- Row 2, Column 1 comment -->
...
| data25        = <!-- Row 25, Column 1 data. {{Bar chart 4x9}} only supports up to data9. -->
| comment25     = <!-- Row 25, Column 1 comment. {{Bar chart 4x9}} only supports up to comment9.  -->

| col2_data_type= <!-- Title for column 2 data -->
| col2_data_max = <!-- Upper bound on the values in column 2 data fields (uses col2_data1 if not present) -->
| col2_data1    = <!-- Row 1, Column 2 data -->
| col2_comment1 = <!-- Row 1, Column 2 comment -->
| col2_data2    = <!-- Row 2, Column 2 data -->
| col2_comment2 = <!-- Row 2, Column 2 comment -->
...
| col2_data25   = <!-- Row 25, Column 2 data. {{Bar chart 4x9}} only supports up to col2_data9.  -->
| col2_comment25= <!-- Row 25, Column 2 comment. {{Bar chart 4x9}} only supports up to col2_comment9.  -->
}}

Alignment[sửa mã nguồn]

To float the bar chart on the right of the page, use

| float       = right

To float the bar chart on the left of the page, use

| float       = left

To float the bar chart to the center of the page, use

| float       = center

The default is none.

Caption[sửa mã nguồn]

To add a caption to the bottom of the chart, use

| caption     = 

Ví dụ[sửa mã nguồn]

Largest cities of Foo, 2009 Census
City Population
City1
540.921
City2
194.343
City3
190.414
City4
134.669
City5
114.983
{{Bar chart
| title       = Largest cities of Foo, 2009 Census
| label_type  = City
| data_type   = Population
| bar_width   = 35
| width_units = em
| data_max    = 600000
| label1   = City1
| data1    = 540,921
| label2   = City2
| data2    = 194,343
| label3   = City3
| data3    = 190,414
| label4   = City4
| data4    = 134,669
| label5   = City5
| data5    = 114,983
}}

Example with comments[sửa mã nguồn]

Annual revenue passenger statistics
Year Passengers (% change from prior year)
2003-04
110.649(+17.8%)
2004-05
130.429(+17.9%)
2005-06
138.547(+6.2%)
2006-07
138.844(+0.2%)
2007-08
149.544(+7.7%)
2008-09
148.435(-0.7%)
2009-10
168.147(+13.3%)
{{Bar chart
| title      = Annual [[revenue passenger]] statistics
| label_type = Year
| data_type  = Passengers (% change from prior year)
| data_max   = 170,000
| label3  = 2003-04 | data3  = 110,649 | comment3  = +17.8%
| label4  = 2004-05 | data4  = 130,429 | comment4  = +17.9%
| label5  = 2005-06 | data5  = 138,547 | comment5  =  +6.2%
| label6  = 2006-07 | data6  = 138,844 | comment6  =  +0.2%
| label7  = 2007-08 | data7  = 149,544 | comment7  =  +7.7%
| label8  = 2008-09 | data8  = 148,435 | comment8  =  -0.7%
| label9  = 2009-10 | data9  = 168,147 | comment9  = +13.3%
}}

Example with two data columns[sửa mã nguồn]

Annual passenger and aircraft statistics
Fiscal year Revenue passengers Aircraft movements
2001-02
20.194
2.281
2002-03
22.057
2.633
2003-04
34.794
2.664
2004-05
49.234
2.754
2005-06
57.732
3.004
2006-07
64.881
2.956
2007-08
63.904
2.912
2008-09
54.718
2.811
2009-10
52.210
2.791
{{Bar chart
| title       = Annual passenger and aircraft statistics
| bar_width   = 20
| width_units = em
| label_type  = [[Fiscal year]]
| label1  = 2001-02
| label2  = 2002-03
| label3  = 2003-04
| label4  = 2004-05
| label5  = 2005-06
| label6  = 2006-07
| label7  = 2007-08
| label8  = 2008-09
| label9  = 2009-10
| data_type = Revenue passengers
| data_max  = 66,000
| data1  = 20,194
| data2  = 22,057
| data3  = 34,794
| data4  = 49,234
| data5  = 57,732
| data6  = 64,881
| data7  = 63,904
| data8  = 54,718
| data9  = 52,210
| col2_data_type = Aircraft movements
| col2_data_max  = 3,200
| col2_data1  = 2,281
| col2_data2  = 2,633
| col2_data3  = 2,664
| col2_data4  = 2,754
| col2_data5  = 3,004
| col2_data6  = 2,956
| col2_data7  = 2,912
| col2_data8  = 2,811
| col2_data9  = 2,791
}}