Bias Parameter
Dynamically adjust queried values by adding a Param value. The SQL expression is re-computed in the database upon updates.
Loading Example... ⏳
Specification
js
import * as vg from "@uwdata/vgplot";
await vg.coordinator().exec([
vg.loadParquet("walk", "data/random-walk.parquet")
]);
const $point = vg.Param.value(0);
export default vg.vconcat(
vg.slider({label: "Bias", as: $point, min: 0, max: 1000, step: 1}),
vg.plot(
vg.areaY(
vg.from("walk"),
{x: "t", y: vg.sql`v + ${$point}`, fill: "steelblue"}
),
vg.width(680),
vg.height(200)
)
);
yaml
meta:
title: Bias Parameter
description: >
Dynamically adjust queried values by adding a Param value.
The SQL expression is re-computed in the database upon updates.
data:
walk: { file: data/random-walk.parquet }
params:
point: 0
vconcat:
- input: slider
label: Bias
as: $point
min: 0
max: 1000
step: 1
- plot:
- mark: areaY
data: { from: walk }
x: t
y: { sql: v + $point }
fill: steelblue
width: 680
height: 200
json
{
"meta": {
"title": "Bias Parameter",
"description": "Dynamically adjust queried values by adding a Param value. The SQL expression is re-computed in the database upon updates.\n"
},
"data": {
"walk": {
"file": "data/random-walk.parquet"
}
},
"params": {
"point": 0
},
"vconcat": [
{
"input": "slider",
"label": "Bias",
"as": "$point",
"min": 0,
"max": 1000,
"step": 1
},
{
"plot": [
{
"mark": "areaY",
"data": {
"from": "walk"
},
"x": "t",
"y": {
"sql": "v + $point"
},
"fill": "steelblue"
}
],
"width": 680,
"height": 200
}
]
}