Published
Edited
Dec 6, 2018
Insert cell
Insert cell
Insert cell
Insert cell
idDoArtista = '6tdM5Njlln7nWkonCppW0u'
Insert cell
Insert cell
data = {
const popularidadeMinima = 50; // de 0 a 100
const brutos = await d3.json('https://observable-cors.glitch.me/' + 'http://labs.polsys.net/playground/spotify/getnet.php?id=' + idDoArtista);
const ids_mantidos = brutos.nodes.filter(d => d.size > popularidadeMinima).map(d => d.id)
const filtrados = {
'nodes' : brutos.nodes.filter(d => ids_mantidos.includes(d.id)),
'edges' : brutos.edges.filter(d => ids_mantidos.includes(d.source) && ids_mantidos.includes(d.target))
}
return filtrados
}
Insert cell
height = 800
Insert cell
color = {
return d => {if(d.id === idDoArtista) return "salmon"; return "steelblue"};
}
Insert cell
sizeScale = {
var width = d3.scaleLinear()
.domain([50, 100])
.range([2, 20])
return d => width(d.size);
}
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