틀:Graph:Lines: 두 판 사이의 차이
내용 삭제됨 내용 추가됨
mw:Template:Graph:Lines에서 Bouzinac,Timbaaa: "Syncing from sandbox - with two new parameters"에 의한 편집 한 개를 복사함. (docs, translate) |
편집 요약 없음 |
||
1번째 줄: | 1번째 줄: | ||
<includeonly>{{#tag:{{#if:{{{debug|}}}|syntaxhighlight|graph}}|</includeonly><noinclude>{{ |
<includeonly>{{#tag:{{#if:{{{debug|}}}|syntaxhighlight|graph}}|</includeonly><noinclude>{{documentation}}<syntaxhighlight lang=html><graph mode="interactive" title=""></syntaxhighlight>{{#tag:syntaxhighlight|</noinclude> |
||
{ |
{ |
||
// |
// |
||
114번째 줄: | 114번째 줄: | ||
{{#ifeq:{{{xTicks|7}}}|-||, "ticks": {{{xTicks|7}}}}} |
{{#ifeq:{{{xTicks|7}}}|-||, "ticks": {{{xTicks|7}}}}} |
||
{{#if:{{{xAxis|}}}|, "title": "{{{xAxis}}}"}} |
{{#if:{{{xAxis|}}}|, "title": "{{{xAxis}}}"}} |
||
{{#if:{{{xAxisFormat|}}}|, "format": "{{{xAxisFormat}}}"}} |
|||
{{#if:{{{xGrid|}}}|, "grid": true}} |
{{#if:{{{xGrid|}}}|, "grid": true}} |
||
}, |
}, |
||
119번째 줄: | 120번째 줄: | ||
{{#ifeq:{{{yTicks|-}}}|-||, "ticks": {{{yTicks}}}}} |
{{#ifeq:{{{yTicks|-}}}|-||, "ticks": {{{yTicks}}}}} |
||
{{#if:{{{yAxis|}}}|, "title": "{{{yAxis}}}"}} |
{{#if:{{{yAxis|}}}|, "title": "{{{yAxis}}}"}} |
||
{{#if:{{{yAxisFormat|}}}|, "format": "{{{yAxisFormat}}}"}} |
|||
{{#if:{{{yGrid|}}}|, "grid": true}} |
{{#if:{{{yGrid|}}}|, "grid": true}} |
||
} |
} |
2021년 2월 20일 (토) 06:06 판
<graph mode="interactive" title="">
{
//
// ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:Lines
// Please do not modify it anywhere else, as it may get copied and override your changes.
// Suggestions can be made at https://www.mediawiki.org/wiki/Template_talk:Graph:Lines
//
// Template translation is in https://commons.wikimedia.org/wiki/Data:Original/Template:Graphs.tab
//
"version": 2,
"width": 400,
"height": 300,
"padding": "strict",
"signals": [{"name": "rightwidth", "expr": "width + padding.right"}],
"data": [{
"name": "chart",
"url": "tabular:///{{{table}}}",
"format": {"type": "json"
, "property": "data"
},
"transform": [
// Convert xField parameter into a field "_xfield"
{"type": "formula", "field": "_xfield", "expr":
"datetime(datum.year, 0, 1)"
}
, {"type": "sort", "by": ["_xfield"]}
, {"type": "formula", "field": "_yfield", "expr": "datum.value" }
]
},
],
"scales": [
{
"name": "x",
"type": "time",
"domain": {"data": "chart", "field": "_xfield"},
"range": "width",
},
{
"name": "y",
"type": "linear",
"range": "height",
"domain": {"data": "chart", "field": "_yfield"},
},
{
"name": "color",
"type": "ordinal",
"domain": {"data": "chart", "field": "key"},
"range": "category10"
},
],
"axes": [
{"scale": "x", "type": "x", "tickSizeEnd": 0
, "ticks": 7
},
{"scale": "y", "type": "y", "tickSizeEnd": 0
}
],
"marks": [
// Group data by the group parameter or "key", and draw lines, one line per group
{
"type": "group",
"from": {
"data": "chart",
"transform": [{"type": "facet", "groupby": ["key"]}]
},
"marks": [
{
"type": "line",
"properties": {
"enter": {
"y": {"scale": "y", "field": "_yfield"},
"x": {"scale": "x", "field": "_xfield"},
"stroke": {"scale": "color", "field": "key"},
"interpolate": {"value": "monotone"},
"strokeWidth": {"value": 2.5}
}
}
}
],
}
]
}
</graph>