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

125 lines
2.9 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,
2022-03-23 00:38:01 +00:00
"data": [{ "name": "con" }, { "name": "dis" }],
2022-02-27 04:41:30 +00:00
"signals": [
{
"name": "mousex",
"description": "x position of mouse",
"update": "0",
2022-03-23 00:38:01 +00:00
"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": 1.0,
"bind": {
"input": "range",
"min": 0.1,
"max": 1
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": 1.0,
"bind": {
"input": "range",
"min": 0.1,
"max": 1
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" },
"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" },
"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": [
2022-03-23 00:38:01 +00:00
{ "orient": "bottom", "scale": "xscale", "tickCount": 20 },
{ "orient": "left", "scale": "yscale" }
2022-02-27 04:41:30 +00:00
],
"marks": [
{
"type": "area",
2022-03-23 00:38:01 +00:00
"from": { "data": "con" },
2022-02-27 04:41:30 +00:00
"encode": {
"enter": {
2022-03-23 00:38:01 +00:00
"tooltip": { "signal": "datum.cdf" }
2022-02-27 04:41:30 +00:00
},
"update": {
2022-03-23 00:38:01 +00:00
"x": { "scale": "xscale", "field": "x" },
"y": { "scale": "yscale", "field": "y" },
"y2": { "scale": "yscale", "value": 0 },
2022-02-27 04:41:30 +00:00
"fill": {
2022-03-23 00:38:01 +00:00
"signal": "{gradient: 'linear', x1: 1, y1: 1, x2: 0, y2: 1, stops: [ {offset: 0.0, color: 'steelblue'}, {offset: clamp(mousex, 0, 1), color: 'steelblue'}, {offset: clamp(mousex, 0, 1), color: 'blue'}, {offset: 1.0, color: 'blue'} ] }"
},
"interpolate": { "value": "monotone" },
"fillOpacity": { "value": 1 }
2022-02-27 04:41:30 +00:00
}
}
},
{
"type": "rect",
2022-03-23 00:38:01 +00:00
"from": { "data": "dis" },
2022-02-27 04:41:30 +00:00
"encode": {
"enter": {
2022-03-23 00:38:01 +00:00
"y2": { "scale": "yscale", "value": 0 },
"width": { "value": 1 }
2022-02-27 04:41:30 +00:00
},
"update": {
2022-03-23 00:38:01 +00:00
"x": { "scale": "xscale", "field": "x" },
"y": { "scale": "yscale", "field": "y" }
2022-02-27 04:41:30 +00:00
}
}
},
{
"type": "symbol",
2022-03-23 00:38:01 +00:00
"from": { "data": "dis" },
2022-02-27 04:41:30 +00:00
"encode": {
"enter": {
2022-03-23 00:38:01 +00:00
"shape": { "value": "circle" },
"width": { "value": 5 },
"tooltip": { "signal": "datum.y" }
2022-02-27 04:41:30 +00:00
},
"update": {
2022-03-23 00:38:01 +00:00
"x": { "scale": "xscale", "field": "x" },
"y": { "scale": "yscale", "field": "y" }
2022-02-27 04:41:30 +00:00
}
}
}
]
}