Public
Edited
Aug 24, 2023
Insert cell
Insert cell
bulb1.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
bulbs = FileAttachment("bulb1.csv").csv({typed: true})
Insert cell
viewof features = Inputs.checkbox(["rgb", "wifi", "sensor", "dim", "hub", "BT", "temp"], {label: "features", value: ["rgb"]})
Insert cell
features
Insert cell
function filterFunction(d) {
return features.every(feature => d[feature] === 1);
}
Insert cell
viewof rgb = Inputs.toggle({label: "rgb"})
Insert cell
viewof wifi = Inputs.toggle({label: "wifi"})
Insert cell
viewof sensor = Inputs.toggle({label: "sensor"})
Insert cell
viewof dim = Inputs.toggle({label: "dim"})
Insert cell
viewof hub = Inputs.toggle({label: "hub"})
Insert cell
viewof BT = Inputs.toggle({label: "BT"})
Insert cell
viewof temp = Inputs.toggle({label: "temp"})
Insert cell
bulb = Plot.plot({
marks: [
Plot.dot(bulb1, Plot.dodgeX("middle", {fx: "fixture type", y: "brand", fill: "lumens", r: "price", channels: {id: "id no.", model: "model"}, tip: true}))
], grid: true, color: {legend: true, scheme: "Oranges", reverse:true }, marginLeft: 100, marginBottom: 50

})
Insert cell
bulb2 = Plot.plot({
marks: [

Plot.dot(bulb1, Plot.dodgeX("middle",{ filter: (d) => (d.rgb == 1 && d.wifi ==1 && d.dim == 1), fx: "fixture type", y: "brand", fill: "lumens", r: "price", channels: {id: "id no.", model: "model"}, tip: true}))
], grid: true, color: {legend: true, scheme: "Oranges", reverse:true }, marginLeft: 100, marginBottom: 50

})
Insert cell
height = 400
Insert cell
bulb4 = Plot.plot({
width: 1000, // Set the width of the frame
height: 600, // Set the height of the frame
marks: [
Plot.dot(bulb1, Plot.dodgeX("middle", {
filter: filterFunction,
fx: "fixture type",
y: "brand",
fill: "lumens",
r: "price",
channels: { id: "id no.", model: "model" },
tip: true,
}))
],
grid: true,
color: { legend: true, scheme: "Oranges", reverse: true },
marginLeft: 100,
marginBottom: 50,
style: { // Add the style property for background color
// background: "#5E8993", // Set background color to #15313E
color: "#black", // Set text color to off white
gridColor: "black",// Set grid color to off white
padding: "20px"
}
});
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