Extension:Chartie
Chartie リリースの状態: 安定 |
|
---|---|
実装 | パーサー関数 , タグ |
説明 | Adds support of line charts at your MediaWiki |
作者 | Dolfinus |
最新バージョン | 1.1 (2024-04-01) |
MediaWiki | 1.25+ |
データベースの変更 | いいえ |
ライセンス | MIT ライセンス |
ダウンロード | master スナップショットをダウンロード 注: README |
例 | Example of line chart to wiki page |
$wgChartie |
|
<chart> |
|
説明
MediaWiki extension which allows to add simple line charts to site pages. Based on d3.js, renders image as SVG. There you can see example chart page.
例
折れ線グラフの例
Supported file extensions
CSV
- .csv
インストール
- ダウンロードして、ファイルを
extensions/
フォルダー内のChartie
という名前のディレクトリ内に配置します。 - 以下のコードを LocalSettings.php ファイルの末尾に追加します:
wfLoadExtension( 'Chartie' );
- $wgFileExtensions パラメータの変更:
$wgFileExtensions = array_merge(
$wgFileExtensions, array(
'csv'
)
);
- 完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。
使用法
イメージハンドラーとして使用する
[[File:Data.csv|800x350px|legend_title=,x_title=,...]]
パーサー関数として使用する
{{#chart: Name;x_value1;y_value1 Name;x_value2;y_value2 ...}}
または
{{#chart:Data.csv}}
パラメータ付き:
{{#chart:Data.csv|width}} {{#chart:Data.csv|width|height}} ... {{#chart:Data.csv|width|height|legend_title|x_type|x_title|x_unit|x_null|y_type|y_title|y_unit|y_null|delimiter|style|class}}
Instead of uploaded filename you also can use an url for file located in external site.
As Parser tag
<chart data="Data.csv" width="" height="" ... ></chart>
または
<chart width="" height="" ... >Data.csv</chart>
または
<chart width="" height="" ... >
Name;x_value1;y_value1
Name;x_value2;y_value2
</chart>
You also can use url instead of short filename.
パラメーター
名前 | 説明 | 既定値 |
---|---|---|
width | Chart container width | 865 |
height | Chart container height | 360 |
legend_title | Title of Legend block | Solvents: |
x_type | Type of x axis value | temp |
x_title | Title for x axis | Temperature |
x_unit | Unit for x axis | C |
x_null | If true, use 0 as begin of x axis | false |
y_type | Type of y axis value | solub |
y_title | Title for y axis | Solubility |
y_unit | Unit for y axis | g/100g |
y_null | If true, use 0 as begin of y axis | false |
delimiter | Delimiter for csv file | ; |
style | Chart container CSS style | |
class | Chart container HTML class |
Width and height can be set to auto, so size of container will be set according to user screen dimensions.
Type of axis defines available units list, that could be converted to each one. If you want to use your own units, set axis type to general. If you want to no use unit convertation at all, set axis type to no. By default, axis titles and units are automatically sets its value, based on type (as =type name and =first unit in list):
Axis types and units
タイプ | ユニット |
---|---|
general | a,f,p,n,u,m,c,d, ,K,M,G,T,P (接頭辞) |
time | 秒、分、時間、日、月、年 |
mass | mg,ct,g,oz,lb,kg,ton |
length | mm,cm,in,ft,yd,m,km,mile |
area | mm2,cm2,in2,dm2,ft2,yd2,m2,a,da,acre,ha,km2,mile2 |
volume | mm3,cm3,pt,qt,l,gal,br,m3,km3 |
speed | mps,knot,mph,fps,kph,kps,c |
temp | C,K,F,Ra |
solub | g/100g,% |
Localizations
For now, extension is also translated to Russian, so you can use localized units name (for example, ‘кг’ instead of ‘kg’). Full list of localizations can be found at i18n dir, they are named to langs.
設定
All default values can be changed in your LocalSettings.php file:
$wgChartie["width"] = 865;
$wgChartie["height"] = 360;
...
$wgChartie["class"] = 'someclass';
コントロール
操作 | コントロール |
---|---|
Mouse over line, touch line | Show tooltip with extrapolated value |
Mouse over line dots, touch dot | Show tooltip with exact value |
Click on axis title | Show values from min / from zero |
Click on axis unit | Convert values to new unit |
Double click at line | Hide specified line |
Click or touch legend item | Hide/show specified line |
Click on legend title | Hide/show all lines |
- Stable extensions/ja
- Parser function extensions/ja
- Tag extensions/ja
- MIT licensed extensions/ja
- Extensions in GitHub version control/ja
- ParserMakeImageParams extensions/ja
- ParserFirstCallInit extensions/ja
- ImageBeforeProduceHTML extensions/ja
- ImageOpenShowImageInlineBefore extensions/ja
- BeforePageDisplay extensions/ja
- BeforePageDisplayMobile extensions/ja
- All extensions/ja
- Graph extensions/ja