Skip to content

Commit

Permalink
fix: format tooltip to 2 decimal place
Browse files Browse the repository at this point in the history
  • Loading branch information
ninetteadhikari committed Mar 7, 2024
1 parent 09bc073 commit 69b1752
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
if (time > 0) {
// The Date object takes value in milliseconds rather than seconds. So to use a Unix timestamp we multiply it by 1000.
const date = new Date(time * 1000)
// billboardjs supports date format as 'YYYY-MM-DD'
return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() // Adding an extra 1 for month as January starts from 0
}
return commit
Expand Down Expand Up @@ -76,6 +77,14 @@
zoom: {
enabled: true,
},
tooltip: {
format: {
value: function(value, ratio, id) {
const format = d3.format('.2f');
return format(value);
}
}
},
bindto: {{chart_elem_id}}
});
</script>

0 comments on commit 69b1752

Please sign in to comment.