Public
Edited
Oct 31, 2023
Fork of Simple D3
Insert cell
Insert cell
chart = {
const width = 928; // uncomment for responsive width
const height = 200;
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height])
.attr("width", width)
.attr("height", height)
.attr("style", "max-width: 100%; height: auto;");

svg
.selectAll("circle")
.data(d3.range(18))
.join("circle")
.attr("cx", d => 30 + d * 50)
.attr("cy", height / 2)
.attr("r", d => Math.random() * 20)
.attr("fill", "#001b42");
return svg.node();
}
Insert cell
workbook = FileAttachment("statistic_id1393782_us-adults_-responsibility-for-social-media-impact-on-childrens-mental-health-2023 (2).xlsx").xlsx()
Insert cell
workbook.sheetNames
Insert cell
data = workbook.sheet(0, {
headers: false,
// range: "A1:J10"
})
Insert cell
processedData = data.map(row => ({
"Parties to be held accountable": row.A,
"Share of Respondants": row.B
}));
Insert cell
processedData
X
Parties to be held accountable
Y
Share of Respondants
Color
Size
Facet X
Facet Y
Mark
bar
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
According to an online survey conducted in January 2023, 51 percent of adults in the United States felt the responsibility to protect children from social media harm fell upon parents. Overall, one in five respondents stated that the impact of social media on children's mental health was the responsibility of social media companies, and five percent said social media users were responsible for protecting kids from potential social media harm.
Insert cell
workbook1 = FileAttachment("statistic_id207489_teen-perspectives-on-negative-effects-of-social-media-in-the-us-2018 (1).xlsx").xlsx()
Insert cell
workbook1.sheetNames
Insert cell
data1 = workbook1.sheet(0, {
headers: false,
// range: "A1:J10"
})
Insert cell
processedData1 = data1.map(row => ({
"Reasons why social media has a negative effect on teens": row.A,
"Share of Respondants(%)": row.B
}));
Insert cell
processedData1
X
Reasons why social media has a negative effect on teens
Y
Share of Respondants(%)
Color
#158192
Size
Facet X
Facet Y
Mark
bar
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
workbook2 = FileAttachment("statistic_id1302733_us-health-concerns-for-children-teens-during-covid-19-according-to-parents-2020 (1).xlsx").xlsx()
Insert cell
workbook2.sheetNames
Insert cell
data2 = workbook2.sheet(0, {
headers: false,
// range: "A1:J10"
})
Insert cell
processedData2 = data2.map(row => ({
"Resons for concern during COVID": row.A,
"Share of Respondants(%)": row.B
}));
Insert cell
processedData2
X
Resons for concern during COVID
Y
Share of Respondants(%)
Color
Size
Facet X
Facet Y
Mark
dot
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
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