imported>Admin |
imported>Admin |
Linha 11: |
Linha 11: |
| == teste == | | == teste == |
|
| |
|
| { | | {{Graph:Chart|width=600|height=100|xAxisTitle=X|yAxisTitle=Y |
| //
| | |type=rect|x=1,2,3,4,5,6,7,8|y=10,12,6,14,2,10,7,9}} |
| // 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,
| | {{Graph:Chart|width=100|height=100|type=pie|legend=Legende |
| "width": 400,
| | |x=A,B,C,D,E,F,G,H,I|y1=100,200,150,300,100,100,150,50,200 |
| "height": 300,
| | |y2=7,8,9,8,8,9,10,9,5|showValues=}} |
| "padding": "strict",
| |
| "signals": [{"name": "rightwidth", "expr": "width + padding.right", "init":"400"}],
| |
| "data": [{
| |
| "name": "chart",
| |
| "url": "tabular:///bls.gov/US Women's weekly earnings as a percent of men's by age, annual averages.tab",
| |
| "format": {"type": "json"
| |
| , "property": "data"
| |
|
| |
| },
| |
| "transform": [
| |
|
| |
|
| | | {{Graph:Chart|width=400|height=100|xAxisTitle=X|yAxisTitle=Y |
| // Convert xField parameter into a field "_xfield"
| | |legend=Legend|type=stackedarea|x=1,2,3,4,5,6|y1=10,12,6,14,2,10 |
| {"type": "formula", "field": "_xfield", "expr":
| | |y2=2,4,6,8,13,11|interpolate=monotone|colors=seagreen,orchid}} |
| "datetime(datum.year, 0, 1)"
| |
| }
| |
| , {"type": "sort", "by": ["_xfield"]}
| |
| , {"type": "fold", "fields": ["age_16_24", "age_25_34", "age_35_44", "age_45_54"]}
| |
| , {"type": "formula", "field": "_yfield", "expr": "datum.value" }
| |
| | |
| ]
| |
| },
| |
| // source of labels for `tabletype=tab`
| |
| {
| |
| "name": "labels",
| |
| "url": "tabular:///bls.gov/US Women's weekly earnings as a percent of men's by age, annual averages.tab",
| |
| "format": {"type": "json", "property": "fields"},
| |
| "transform": [
| |
| | |
| | |
| ]
| |
| },
| |
| | |
| | |
| | |
| ],
| |
| "scales": [
| |
| {
| |
| "name": "x",
| |
| "type": "time",
| |
| "domain": {"data": "chart", "field": "_xfield"},
| |
| "range": "width",
| |
|
| |
| | |
|
| |
| },
| |
| {
| |
| "name": "y",
| |
| "type": "linear",
| |
| "range": "height",
| |
| "domain": {"data": "chart", "field": "_yfield"},
| |
| "zero": false,
| |
| "domainMin": 50,
| |
| "domainMax": 100,
| |
|
| |
| },
| |
| {
| |
| "name": "color",
| |
| "type": "ordinal",
| |
| "range": "category10",
| |
| "domain": {"data": "chart", "field": "key"}
| |
| },
| |
| {
| |
| "name": "labels",
| |
| "type": "ordinal",
| |
| "domain": {"data": "labels", "field": "name"},
| |
| "range": {"data": "labels", "field": "title"},
| |
| }
| |
| ],
| |
| | |
| "axes": [
| |
| {
| |
| "scale": "x", "type": "x", "tickSizeEnd": 0,
| |
| "ticks": 7,
| |
|
| |
|
| |
|
| |
| "properties": {
| |
| "labels": {
| |
|
| |
|
| |
| }
| |
| }
| |
| },
| |
| {
| |
| "scale": "y", "type": "y", "tickSizeEnd": 0,
| |
|
| |
|
| |
|
| |
|
| |
| "properties": {
| |
| "labels": {
| |
|
| |
|
| |
| }
| |
| }
| |
| }
| |
| ],
| |
| | |
| "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": {
| |
| "hover": {
| |
| "stroke": {"value": "red"}
| |
| },
| |
| "update": {
| |
| "stroke": {"scale": "color", "field": "key"}
| |
| },
| |
| "enter": {
| |
| "y": {"scale": "y", "field": "_yfield"},
| |
| "x": {"scale": "x", "field": "_xfield"},
| |
| "stroke": {"scale": "color", "field": "key"},
| |
| "interpolate": {"value": "linear"},
| |
| "strokeWidth": {"value": 2.5}
| |
| }
| |
| }
| |
| }
| |
|
| |
| ],
| |
| },
| |
| | |
| | |
| | |
| | |
| | |
| ]
| |
| } | |