Public
Edited
Mar 23, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
rawData = FileAttachment("acquisitions_update_2021.csv").csv()
Insert cell
// filter out the record between 2000 and 2021
// since Disney is not a tech company, I deleted all its records as well
filteredData = rawData.filter(row => row["Acquisition Year"] >= 2000 && row["Acquisition Year"] <= 2021
&& row["Parent Company"] !== "Disney")
Insert cell
// construct the list of acquirers
acquirers = [...new Set(filteredData.map(item => item["Parent Company"]))].map(item => ({id: item, year: 2000}));
Insert cell
// some tech giant companies hadn't established in 2000
acquirers.forEach(item => {
if (item.id == "Twitter") {item.year = 2006};
if (item.id == "Facebook") {item.year = 2004};
});
Insert cell
// construct the list of the acquired
acquired = [...new Set(filteredData.map(item => ({id: item["Acquired Company"], year: Number(item["Acquisition Year"])})))];
Insert cell
// construct nodes by combining the acquirers and the acquired
nodes = acquirers.concat(acquired)
Insert cell
Insert cell
// combine nodes and links for D3 usage
data = ({nodes, links})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
colorScale = d3.scaleOrdinal(["Apple", "Twitter", "Amazon", "Hp", "Google", "Microsoft", "Blackberry", "Ebay", "Ibm", "Adobe", "Facebook", "Redhat", "Citrix"], d3.schemeCategory10).unknown("lightgrey");
Insert cell
color = d => colorScale(d.id)
Insert cell
Insert cell
Insert cell
import {Swatches} from "@d3/color-legend"
Insert cell
d3 = require("d3@7")
Insert cell
import {Scrubber} from "@mbostock/scrubber"
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