फलकम्:Bar chart/doc
This is a documentation subpage for फलकम्:Terminate sentence It may contain usage information, categories and other content that is not part of the original फलकम् page. |
{{Bar chart}} handles up to 4 columns and 25 rows of data |
This template can be used to create a horizontal bar chart, scrolling down a page, in a format which can be parsed by text-based web browsers. The data items can be simple numbers, or the result of calculations based on template parameters.
Each data number (data1=7, data2=23...), in column 1, is scaled to parameter "data_max=" and the bars are sized by width in units, such as "bar_width=16" and "width_units=em". By default, the data numbers are shown within each bar, but might display outside a bar when a relatively small number generates a short bar. Each bar can also have a comment, such as "comment7=xx" to show "(xx)" after the number in bar 7.
For a 2-column bar chart, the 2nd column items have prefix "col2_" such as scale maximum, col2_data_max=110, and col2_data3=67 with col2_comment3=zz. See below: "Example with two data columns". Each bar chart can be formatted typically within 1/5 second.
Usage and parameters
सम्पादयतु- 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
सम्पादयतु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
सम्पादयतुTo add a caption to the bottom of the chart, use
| caption =
Example
सम्पादयतुCity | Population |
---|---|
City1 | ५४०,९२१
|
City2 | १९४,३४३
|
City3 | १९०,४१४
|
City4 | १३४,६६९
|
City5 | ११४,९८३
|
{{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
सम्पादयतुYear | Passengers (% change from prior year) |
---|---|
2003-04 | ११०,६४९(+17.8%)
|
2004-05 | १३०,४२९(+17.9%)
|
2005-06 | १३८,५४७(+6.2%)
|
2006-07 | १३८,८४४(+0.2%)
|
2007-08 | १४९,५४४(+7.7%)
|
2008-09 | १४८,४३५(-0.7%)
|
2009-10 | १६८,१४७(+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
सम्पादयतुFiscal year | Revenue passengers | Aircraft movements |
---|---|---|
2001-02 | २०,१९४ |
२,२८१
|
2002-03 | २२,०५७ |
२,६३३
|
2003-04 | ३४,७९४ |
२,६६४
|
2004-05 | ४९,२३४ |
२,७५४
|
2005-06 | ५७,७३२ |
३,००४
|
2006-07 | ६४,८८१ |
२,९५६
|
2007-08 | ६३,९०४ |
२,९१२
|
2008-09 | ५४,७१८ |
२,८११
|
2009-10 | ५२,२१० |
२,७९१
|
{{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 }}
See also
सम्पादयतु- {{Historical populations}} (meets accessibility guidelines)
- {{Bar box}}, shows bar chart with a text column after the bars or bar-pairs
- {{Pie chart}}, shows pie wedges in a circular pie chart
- {{Brick chart}}, shows brick segments in a rectangular "pie chart"
- {{Vertical bar chart}} (does not meet accessibility guidelines due to the lack of alternative text)
- WP:Graphs