Published
Edited
May 14, 2020
Fork of topic1_reco
Insert cell
md`# topic1_viewcount`
Insert cell
d3 = require("d3@5", "d3-textwrap")
Insert cell
graphData = FileAttachment("topic1_viewcount@3.json").json()
Insert cell
allNodesNames = graphData.nodes.map(function(d){return d.tag});
Insert cell
eachnode= graphData.nodes
Insert cell
margin = ({top: 20, bottom: 20, left: 30, right: 30});
Insert cell
height = 450 - margin.top - margin.bottom;
Insert cell
width = 1500
Insert cell
xScale_vids_ufo = d3.scalePoint()
.domain(videonames_ufo)
.range([0, width])
Insert cell
ufo_vids = graphData.nodes[0].top_vids_conspi
Insert cell
videonames_ufo = ufo_vids.map(function(d){return d.title});
Insert cell
Insert cell
xScale_vids_aliens = d3.scalePoint()
.domain(videonames_aliens)
.range([0, width])
Insert cell
aliens_vids = graphData.nodes[1].top_vids_conspi
Insert cell
videonames_aliens = aliens_vids.map(function(d){return d.title});
Insert cell
Insert cell
videonames_space = space_vids.map(function(d){return d.title});
Insert cell
space_vids = graphData.nodes[2].top_vids_conspi
Insert cell
xScale_vids_space = d3.scalePoint()
.domain(videonames_space)
.range([0, width])
Insert cell
Insert cell
videonames_nasa = nasa_vids.map(function(d){return d.title});
Insert cell
nasa_vids = graphData.nodes[3].top_vids_conspi
Insert cell
xScale_vids_nasa = d3.scalePoint()
.domain(videonames_nasa)
.range([0, width])
Insert cell
Insert cell
videonames_earth = earth_vids.map(function(d){return d.title});
Insert cell
earth_vids = graphData.nodes[4].top_vids_conspi
Insert cell
xScale_vids_earth = d3.scalePoint()
.domain(videonames_earth)
.range([0, width])
Insert cell
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