Published
Edited
Oct 7, 2020
Fork of HEATMAP
1 fork
Insert cell
Insert cell
Insert cell
function indexData(data) {
var indexedData = []
let k = 0;
var i;
for (i = 0; i < 13; i++) {
var j;
for (j = 0; j < 24; j++) {

indexedData.push({
Date: data[k].Date,
Column: j,
Row: i,
Goal: +data[k].Gls,
Assist: +data[k].Ast,
Comb: data[k].Date=="" ? "END" : (+data[k].Ast) + (+data[k].Gls),
});
data[k].Date=="" ? j=25: j=j;
k++;
}
}
return indexedData
}
Insert cell
tooltip = {
chart
const tooltip = d3.select("body").append("div")
.attr("class", "svg-tooltip-heat")
.style("position", "absolute")
.style("visibility", "hidden")
.text("Im a circle!!!!!!!!!!!!!!!")
.style("font-size", "18px")
.style("color", "red")
.attr("font-family", "monospace");

d3.selectAll("#rectangle")
.on("mouseover", function(d){
console.log('da d',d);
return tooltip.style("visibility", "visible").style("top", 80 + (d.Row) * gridSize*1.2+"px").style("left", 20+(d.Column) * gridSize*1.1+"px").text(days(d.Date)+", "+d.Row+", "+d.Column);
})
.on("mouseout", function(){
return tooltip.style("visibility", "hidden");
});
}
Insert cell
days("2017-08-13")
Insert cell
Insert cell
Insert cell
function days(date) {
return format(parseTime(date))
}
Insert cell
dataNew = data2.concat(data3);
Insert cell
dataDex = indexData(dataNew)
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