Published
Edited
May 14, 2020
Fork of topic2_reco
Insert cell
md`# topic2_viewcount`
Insert cell
d3 = require("d3@5", "d3-textwrap")
Insert cell
graphData = FileAttachment("topic2_viewcount@6.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_one = d3.scalePoint()
.domain(videonames_one)
.range([0, width])
Insert cell
one_vids = graphData.nodes[0].top_vids_conspi
Insert cell
videonames_one = one_vids.map(function(d){return d.title});
Insert cell
Insert cell
xScale_vids_two = d3.scalePoint()
.domain(videonames_two)
.range([0, width])
Insert cell
two_vids = graphData.nodes[1].top_vids_conspi
Insert cell
videonames_two = two_vids.map(function(d){return d.title});
Insert cell
Insert cell
videonames_three = three_vids.map(function(d){return d.title});
Insert cell
three_vids = graphData.nodes[2].top_vids_conspi
Insert cell
xScale_vids_three = d3.scalePoint()
.domain(videonames_three)
.range([0, width])
Insert cell
Insert cell
videonames_four = four_vids.map(function(d){return d.title});
Insert cell
four_vids = graphData.nodes[3].top_vids_conspi
Insert cell
xScale_vids_four = d3.scalePoint()
.domain(videonames_four)
.range([0, width])
Insert cell
Insert cell
videonames_five = five_vids.map(function(d){return d.title});
Insert cell
five_vids = graphData.nodes[4].top_vids_conspi
Insert cell
xScale_vids_five = d3.scalePoint()
.domain(videonames_five)
.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