Published
Edited
Oct 16, 2019
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//function addAuthors(ctx,anim){
// let constrainedBody=null;
// anim.article.authors.forEach(function(name){
// let color, mostRecentArticle;
// mostRecentArticle=Math.max(...data.map(d=>d.authors).reduce((arr, e, i) => ((e.includes(name)) && arr.push(i), arr), //[]).map(idx=>data[idx].year));
// if (2019-mostRecentArticle<=2)
// color="rgba(255,223,143,1)";
// else if (2019-mostRecentArticle<=5)
// color="rgba(187,153,84,1)";
// else if (2019-mostRecentArticle<=8)
// color="rgba(172,140,72,1)";
// else
// color="rgba(115,88,38,1)";
// let text=new TextObject(width*Math.random(),-mainFontSize,0,name,ctx,color,data.map(d=>d.authors).filter(d=>d.includes(name)).length-1);
// if (name==extra[anim.articleidx].neighbor)
// constrainedBody=anim.add(text);
// else
// anim.add(text);
// });
// if (Object.entries(extra[anim.articleidx]).length&&constrainedBody!=null){
// let extraName=extra[anim.articleidx].extra.split(" ");
// if (!isNaN(extraName[extraName.length-1]))
// extraName=extraName.slice(0,extraName.length-1).join(" ");
// else
// extraName=extraName.join(" ");
// let extraBody=anim.add(new TextObject(width*Math.random(),-mainFontSize,0,extraName,ctx,"rgba(255,255,255,0.25)",0,true),false,true,0.02);
// anim.addConstraint(constrainedBody,extraBody);
// }
//}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//collabs=[...new Set(data.map(d=>d.authors).reduce(function(a,b){return a.concat(b);}))]
Insert cell
//extra={
// let ret=[];
// for (let i=0;i<data.length;i++){
// if (!data[i].authors.length){
// ret.push({});
// continue;
// }
// let n=data[i].authors[Math.floor(Math.random()*data[i].authors.length)];
// let extra=(await database.query("SELECT a2.name FROM author a1 JOIN author a2 ON a1.idpublication=a2.idpublication WHERE a1.name=? AND a2.name<>? AND a2.name<>? ORDER BY RAND() LIMIT 1",[n,nameInput,n]));
// if (!extra.length){
// ret.push({});;
// continue;
// }
// ret.push({neighbor:n,extra:extra[0].name})
// }
// return ret;
//}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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