Public
Edited
Jul 6, 2024
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mapped[1].data[0].values[60].value
Insert cell
[projection0[60].value, projection1[60].value]
Insert cell
JSON.stringify(projection1)
Insert cell
gem = ({
//"meta": {"name": "All at once"},
staggerings: [
{
name: "a",
by: "year_in",
overlap: 0 //0.7
}
],
timeline: {
concat: [
{
component: { mark: "layer_4_marks" }, // rect
change: {
//data: { keys: ["year_in", "formula"] },
encode: {
update: true,
enter: false,
exit: false
}
},
timing: { staggering: "a", duration: { ratio: 1 } }
},
{
component: { mark: "layer_4_marks" }, // rect
change: {
//data: { keys: ["year_in", "formula"] },
encode: { update: false, enter: true, exit: true }
},
timing: { staggering: "a", staggering: "a", duration: { ratio: 0.2 } }
},

{
component: { mark: "layer_5_marks" },
timing: { /*staggering: "a",*/ duration: { ratio: 0.7 } }
}
]
},
totalDuration: 2000
})
Insert cell
Insert cell
Insert cell
Insert cell
{
if (step != mutable v0) {
console.log("RUNNING");
const animation = await gemini.animate(mapped[v0], mapped[step], gem);
await animation.play("#view");
setV0(step);
console.log("done");
}
}
Insert cell
gemini.animate(mapped[0], mapped[1], gem)
Insert cell
//gemini.animate(mapped[0], mapped[1], gem)
Insert cell
spec0.marks.map((d) => d.name)
Insert cell
viewof chart = embed("#view", mapped[0], { renderer: "svg" })
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mutable v0 = 0
Insert cell
v1 = step
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
introspection1 = await calculang.introspection("entrypoint.cul.js", fs1)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
projection0 = helpers.calcudata({
models: [model0],
outputs: ["premiums", "mclaims", "profit", "mΔreserve"],
input_domains: { year_in: _.range(0, 21 + 0.1, 1) },
input_cursors: [cursor]
//pivot: true
})
//.filter((d) => d.formula == "profit" || Math.abs(d.value) > 0.001)
Insert cell
Insert cell
cursor = ({ premiums_fn_in:() => premiums, claims_fn_in:() => claims, point_id_in: 0, adverse_reserve_factor_in:0, limit_in:10000 })
Insert cell
premiums = [0, ..._.range(0, 19.1).map((year) => 100 - year * 1.5)]
Insert cell
claims = [0, ..._.range(0, 19.1).map((year) => 1.35 ** year)]
Insert cell
mapped[0]
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more