Published
Edited
Mar 7, 2022
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function getData() {
let r = [];
let i = 0;
result.forEach(n => {
const splitUrl = n.url.split('/');
const urlImg = splitUrl[0].replace('http:', 'https:') + '//' + splitUrl[2] + '/favicon.ico';
r.push({id: i,
content: '<a href="'+n.url+'" target="_blank"><img src="'+urlImg+'" style="width:32px; height:32px;"></a>',
start: n.date,
source: n.source,
sumary: n.sumary,
title: n.title});
i++;
});
return r;
}
Insert cell
Insert cell
Insert cell
medios_select = {
let opt = ""
medios.forEach(function(d) {
if('La Nacion' === d.source) {
opt = opt + '<option selected value="' + d.id + '">' + d.source + '</option>'
} else {
opt = opt + '<option value="' + d.id + '">' + d.source + '</option>'
}
});
let str = '<select>' + opt + '</select>'
return(str)
}
Insert cell
medios = {
return d3.json("https://pf2.it.itba.edu.ar/api/medios")
.then(json => {
return json.data;
})
.catch(error => {
console.error(error);
});
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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