Skip to content

Commit

Permalink
add mouse on hover for each rectangle to display x and y values and a…
Browse files Browse the repository at this point in the history
…xis labels. #224
  • Loading branch information
ctcncgr committed Apr 17, 2024
1 parent 3d348c3 commit 30d1eb3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/lis-histogram-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ export class LisHistogramElement extends LitElement {
.attr('y', (d) => y(d.count))
.attr('width', x.bandwidth())
.attr('height', (d) => height - y(d.count))
.attr('fill', 'steelblue');
.attr('fill', 'steelblue')
.append('title') // append a title element to each rectangle
.text((d) => `${this._xlabel}: ${d.name}, ${this._ylabel}: ${d.count}`); // set the text of the title

// Add the x-axis label
svgContainer
Expand Down

0 comments on commit 30d1eb3

Please sign in to comment.