Reputation: 43
I'm trying to include both Date and Value in the same cell using Cal-HeatMap
Here is a fiddle example of what I'm trying to do ....
[https://jsfiddle.net/paulrollings/6L36ajhn/12/][2]
Any advice help greatly appreciated. Thanks Paul
Upvotes: 0
Views: 773
Reputation: 108512
You could hack it in after CalHeatMap renders:
// wrap in timeout to let map render
setTimeout(function(){
var t = d3.selectAll('.subdomain-text') // find all the text blocks
.text(null); // blank them out
t.append('tspan')
.text(function(d){
return new Date(d.t).getDate(); //append tspan with date
})
.attr('x', function(d){
return d3.select(this.parentNode).attr('x'); // steal parent x value so it stays in place
});
t.append('tspan')
.text(function(d){
return "€" + d.v; //append tspan with value
})
.attr('dy','1.2em')
.attr('x', function(d){
return d3.select(this.parentNode).attr('x'); // steal parent x value so it stays in place
});
}, 100);
Updated fiddle here.
Upvotes: 3