tooltip text
This commit is contained in:
parent
5425f24698
commit
6e458bf6a7
@ -1,7 +1,7 @@
|
||||
// set the margins of the graph
|
||||
const margin = {
|
||||
top: 10,
|
||||
right: 30,
|
||||
right: 60,
|
||||
bottom: 30,
|
||||
left: 30
|
||||
};
|
||||
@ -16,7 +16,7 @@ window.onresize = function(){ location.reload(); }
|
||||
|
||||
d3.csv('http://127.0.0.1/output.csv', d => {
|
||||
return {
|
||||
date: new Date(d.h_timestamp.replace(' ', 'T')).getTime(),
|
||||
date: new Date(d.h_timestamp.replace(' ', 'T')),
|
||||
value: parseFloat(d.price.replace('$', '')),
|
||||
skuid: d.skuid,
|
||||
currency: d.currency
|
||||
@ -169,9 +169,11 @@ d3.csv('http://127.0.0.1/output.csv', d => {
|
||||
|
||||
// Interaction functions
|
||||
const mouseover = function(event, d) {
|
||||
// var formatted_date = `${d.date.getDate()}-${d.date.getMonth()}-${d.date.getFullYear()}`;
|
||||
var formatted_date = d.date.toISOString().split('T')[0]
|
||||
Tooltip
|
||||
.style("opacity", 1)
|
||||
.html(d.value + " " + d.currency)
|
||||
.html(formatted_date + "<br />" + d.value + " " + d.currency)
|
||||
.style("left", (event.pageX + 10) + "px")
|
||||
.style("top", (event.pageY + 10) + "px");
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user