תבנית:Graph:Lines – הבדלי גרסאות

נוספו 261 בתים ,  לפני 5 שנים
אין תקציר עריכה
אין תקציר עריכה
אין תקציר עריכה
},
"transform": [
// Convert xField parameter into a field "_xfield"
{"type": "formula", "field": "_xfield", "expr":
{{#switch: {{{type|year}}}
| year= "datetime(datum.{{{xField|year}}}, 0, 1)"
}}
},
{"type": "foldsort", "fieldsby": [{{{series|}}}"_xfield"]},
{{#if:{{{series|}}}
| {"type": "fold", "fields": [{{{series}}}]}
}}
]
},
{{#if:{{{series|}}}|{{#ifeq: {{{tabletype|tab}}} | tab |
{
"name": "labels",
"url": "tabular:///{{{table}}}",
"format": {"type": "json", "property": "schema.fields"}
}
}}}}
],
"scales": [
"type": "linear",
"range": "height",
"domain": {"data": "chart", "field": "{{{value|value}}}"},
{{#if:{{{yZero|}}}|"zero": {{{yZero}}},}}
{{#if:{{{yMin|}}}|"domainMin": {{{yMin}}},}}
"name": "color",
"type": "ordinal",
"domain": {"data": "chart", "field": "{{{group|key}}}"},
"range": "category10"
},
{{#if:{{{series|}}}|
{
"name": "labels",
}}
}
}}
],
{{#if:{{{legend|}}}|
"fill": "color",
"stroke": "color",
{{#ifeq: {{{legend|}}}|-|| "title": "{{{legend|}}}", }}
{{#if:{{{series|}}}
"properties": {
| "properties": { "labels": { "text": {"scale": "labels", "field": "data"} } }
}}
}
}],
}}
"axes": [
{"scale": "x", "type": "x", "tickSizeEnd": 0, "ticks": 7
{{#if:{{{xAxis|}}}|, "title": "{{{xAxis|}}}"}}
{{#if:{{{xGrid|}}}|, "grid": true}}
},
{"scale": "y", "type": "y", "tickSizeEnd": 0
{{#if:{{{yAxis|}}}|, "title": "{{{yAxis|}}}"}}
{{#if:{{{yGrid|}}}|, "grid": true}}
 
"marks": [
// Group data by the group parameter or "key", and draw lines, one line per keygroup
{
"type": "group",
"from": {
"data": "chart",
"transform": [{"groupbytype": ["keyfacet"], "typegroupby": ["facet{{{group|key}}}"]}]
},
"marks": [
"properties": {
"enter": {
"y": {"scale": "y", "field": "{{{value|value}}}"},
"x": {"scale": "x", "field": "_xfield"},
"stroke": {"scale": "color", "field": "{{{group|key}}}"},
"interpolate": {"value": "monotone"},
"strokeWidth": {"value": 2.5}