Releases: bourbonut/detroit
Releases · bourbonut/detroit
v1.2.2
- Improvement of inline functions syntax :
from detroit import Data, Script, d3
data = {"curves": {"values": [{"x": 1, "y": 2}], "color": "blue"}}
data = Data(data)
d = data.datum
vmax = 1
width = 100
script = Script()
x = script(
"x",
d3.scaleLinear()
.domain([-vmax, vmax])
.range([0, width]),
)
y = script(
"y",
d3.scaleLinear()
.domain([-vmax, vmax])
.range([0, width]),
)
print(d.curves.values)
print(d > x(data.curves.values.x))
d = d.curves.values
print(d3.line().x(d > x(d.x)).y(d > y(d.y))(d))
Outputs :
d.values
d => x(d.x)
d3.line().x(d => x(d.x)).y(d => y(d.y))(d.values)
- Add
autoreload
option to avoid pressing the "refresh button" in your browser
render(data, script, autoreload=True)