Public
Edited
Jun 21, 2023
1 star
Insert cell
Insert cell
hexcode = "#" + (0xb3eaf0).toString(16).slice()
Insert cell
healthcare_coinsurance_rate = .2
Insert cell
healthcare_deductible = 800
Insert cell
dental_coinsurance_rate = .5
Insert cell
dental_ductible = 150
Insert cell
insurance = 600 * 12
Insert cell
after_insured_medical_bill = {
if (medical_bil* healthcare_coinsurance_rate >= 6000) {
return 6000
} else {
return medical_bil* healthcare_coinsurance_rate
}
}
Insert cell
after_insured_dental_bill = {
if (dental_bill * dental_coinsurance_rate >= 2000) {
return dental_bill - 2000;
} else {
return dental_bill * dental_coinsurance_rate;
}
}
Insert cell
howmuch_i_pay = insurance + healthcare_deductible + dental_ductible+ after_insured_medical_bill + after_insured_dental_bill
Insert cell
insurance_company_medical = {
if (after_insured_medical_bill >= 6000) {
return medical_bil - 30000 + 30000 * 0.8;
} else {
return medical_bil * 0.8
}
}
Insert cell
insurance_company_dental = {
if (dental_bill * dental_coinsurance_rate >= 2000) {
return 2000 ;
} else {
return dental_bill * dental_coinsurance_rate
}
}
Insert cell
howmuch_insurance_pays = insurance_company_medical + insurance_company_dental
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
width: 1000,
height: 400,
marginLeft: 100,
color: { domain: ["I", "Insurance Company"], range: ["#6140D8", "#BD39E6"] },
marks: [
Plot.barX(data, {
x: "value",
y: "name",
fill: "name"
}),
Plot.text(data, {
text: (d) => `${d.value / 1000} k`,
y: "name",
x: "value",
textAnchor: "end",
dx: -3,
fill: "white",
fontSize: 20,
fontWeight: "bold"
}),
Plot.ruleX([14000])
]
})
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more