Template:Bar box
{{bar box}}と{{bar percent}}、{{bar pixel}}、{{bar percent 2}}は横グラフ…
{{bar box}}と{{bar percent}}、{{bar pixel}}、{{bar percent 2}}は横グラフの表を作るテンプレートです。
使用方法
{{Bar box
|width = 表の幅(任意入力)
|barwidth= バー部分の幅(任意入力、デフォルトは100px)
|float = (left|right|none)表の位置(任意入力、デフォルトはnone)
|title = 表の題名(任意入力)
|titlebar= 表の題名部分の色(任意入力、デフォルトは白)
|left1 = 左部分の最初のヘッダ(任意入力)
|left2 = 左部分の2番目のヘッダ(任意入力)
|right1 = 右部分の最初のヘッダ(任意入力)
|right2 = 右部分の2番目のヘッダ(任意入力)
|bars = バー部分の詳細指定(以下参照)
|caption = 表の最下部に表示する左寄せの文章(任意入力)
}}
バー部分の詳細指定
横グラフの表には以下2種類のバーの設定が可能です。bars節で指定してください。
- パーセンテージバー:
{{bar percent|行のラベル|色|値(パーセントで幅が指定されます)|任意で入力するラベル}}
任意で入力するラベルを指定しない場合は「値%」が表示されます。
- ピクセルバー:
{{bar pixel|行のラベル|色|バーに反映させる値(ピクセルで幅が指定されます)|端数|任意で入力するラベル }}
バーに反映させる値は実際の値から特定の桁で四捨五入した値を指定します。
以下の例は同じ出力結果が出ます。
{{bar pixel|foo|red|12||12,345}}
{{bar pixel|foo|red|12|3,45}}
表示例
{{bar box
|float=right
|caption=分配の割合
|barwidth=200px
|bars=
{{bar percent|foo|red|30}}
{{bar percent|bar|green|40}}
{{bar percent|baz|dodgerblue|20}}
{{bar percent|bla|orange|8}}
{{bar percent|bla|teal|2|1/50}}
}}
{{bar box
|title=原材料の量
|titlebar=#DDD
|left1=原材料の種類
|right2=個数
|width=300px
|bars=
{{bar pixel|Foobar|red|33|,213}}
{{bar pixel|Barfoo|green|123|,123}}
{{bar pixel|Bazbar|blue|210|,121}}
{{bar pixel|Barfoobaz|orange|13||12,854}}
|caption=
}}
{{bar box
|float=right
|title=選挙結果
|titlebar=#AAF
|left1=政党
|left2=年
|right1=得票割合
|right2=比較
|width=350px
|bars=
{{bar percent 2|左派|1898|silver|33|1902|red|42|+9%}}
{{bar percent 2|右派|1898|silver|40|1902|black|35|-5%}}
{{bar percent 2|中道|1898|silver|17|1902|blue|10|-7%}}
{{bar percent 2|その他|1898|silver|10|1902|gray|13|+3%}}
|caption=1902年と1898年の選挙結果の比較
}}
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.