squiggle/packages/components/src/spec-distributions.json

194 lines
3.7 KiB
JSON
Raw Normal View History

2022-02-27 04:41:30 +00:00
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "A basic area chart example.",
"width": 500,
"height": 200,
"padding": 5,
"data": [
{
"name": "con"
},
{
"name": "dis"
}
],
2022-02-27 04:41:30 +00:00
"signals": [
{
"name": "mousex",
"description": "x position of mouse",
"update": "0",
"on": [
{
"events": "mousemove",
"update": "1-x()/width"
}
]
2022-02-27 04:41:30 +00:00
},
{
"name": "xscale",
"description": "The transform of the x scale",
"value": false,
2022-02-27 04:41:30 +00:00
"bind": {
"input": "checkbox",
"name": "log x scale"
2022-03-23 00:38:01 +00:00
}
2022-02-27 04:41:30 +00:00
},
{
"name": "yscale",
"description": "The transform of the y scale",
"value": false,
2022-02-27 04:41:30 +00:00
"bind": {
"input": "checkbox",
"name": "log y scale"
2022-03-23 00:38:01 +00:00
}
2022-02-27 04:41:30 +00:00
}
],
2022-03-23 00:38:01 +00:00
"scales": [
{
"name": "xscale",
"type": "pow",
"exponent": {
"signal": "xscale ? 0.1 : 1"
},
2022-03-23 00:38:01 +00:00
"range": "width",
"zero": false,
"nice": false,
"domain": {
"fields": [
{
"data": "con",
"field": "x"
},
{
"data": "dis",
"field": "x"
}
2022-02-27 04:41:30 +00:00
]
}
2022-03-23 00:38:01 +00:00
},
{
"name": "yscale",
"type": "pow",
"exponent": {
"signal": "yscale ? 0.1 : 1"
},
2022-03-23 00:38:01 +00:00
"range": "height",
"nice": true,
"zero": true,
"domain": {
"fields": [
{
"data": "con",
"field": "y"
},
{
"data": "dis",
"field": "y"
}
2022-02-27 04:41:30 +00:00
]
2022-03-23 00:38:01 +00:00
}
2022-02-27 04:41:30 +00:00
}
],
"axes": [
{
"orient": "bottom",
"scale": "xscale",
"tickCount": 20
}
],
2022-02-27 04:41:30 +00:00
"marks": [
{
"type": "area",
"from": {
"data": "con"
},
2022-02-27 04:41:30 +00:00
"encode": {
"enter": {
"tooltip": {
"signal": "datum.cdf"
}
2022-02-27 04:41:30 +00:00
},
"update": {
"x": {
"scale": "xscale",
"field": "x"
},
"y": {
"scale": "yscale",
"field": "y"
},
"y2": {
"scale": "yscale",
"value": 0
},
2022-02-27 04:41:30 +00:00
"fill": {
"signal": "{gradient: 'linear', x1: 1, y1: 1, x2: 0, y2: 1, stops: [ {offset: 0.0, color: '#11ac8f'}, {offset: clamp(mousex, 0, 1), color: '#11ac8f'}, {offset: clamp(mousex, 0, 1), color: '#1b6fac'}, {offset: 1.0, color: '#1b6fac'} ] }",
"color": "#000"
2022-03-23 00:38:01 +00:00
},
"interpolate": {
"value": "monotone"
},
"fillOpacity": {
"value": 1
}
2022-02-27 04:41:30 +00:00
}
}
},
{
"type": "rect",
"from": {
"data": "dis"
},
2022-02-27 04:41:30 +00:00
"encode": {
"enter": {
"y2": {
"scale": "yscale",
"value": 0
},
"width": {
"value": 1
}
2022-02-27 04:41:30 +00:00
},
"update": {
"x": {
"scale": "xscale",
"field": "x"
},
"y": {
"scale": "yscale",
"field": "y"
}
2022-02-27 04:41:30 +00:00
}
}
},
{
"type": "symbol",
"from": {
"data": "dis"
},
2022-02-27 04:41:30 +00:00
"encode": {
"enter": {
"shape": {
"value": "circle"
},
"width": {
"value": 5
},
"tooltip": {
"signal": "datum.y"
}
2022-02-27 04:41:30 +00:00
},
"update": {
"x": {
"scale": "xscale",
"field": "x"
},
"y": {
"scale": "yscale",
"field": "y"
}
2022-02-27 04:41:30 +00:00
}
}
}
]
}