Browse Source

bars: handle `mouseout` event

pull/1/head
rozetko 2 years ago
parent
commit
70b077286b
  1. 10
      src/index.ts

10
src/index.ts

@ -75,8 +75,9 @@ export class ChartwerkBarPod extends ChartwerkPod<BarSerie, BarOptions> {
.attr('width', this.barWidth) .attr('width', this.barWidth)
.attr('height', (val: number) => this.getBarHeight(val)) .attr('height', (val: number) => this.getBarHeight(val))
.on('contextmenu', this.contextMenu.bind(this)) .on('contextmenu', this.contextMenu.bind(this))
.on('mouseover', (e) => { this.overlay.node().dispatchEvent(new MouseEvent(d3.event.type, d3.event)); }) .on('mouseover', () => { this.overlay.node().dispatchEvent(new MouseEvent(d3.event.type, d3.event)); })
.on('mousemove', (e) => { this.overlay.node().dispatchEvent(new MouseEvent(d3.event.type, d3.event)); }) .on('mousemove', () => { this.overlay.node().dispatchEvent(new MouseEvent(d3.event.type, d3.event)); })
.on('mouseout', () => { this.overlay.node().dispatchEvent(new MouseEvent(d3.event.type, d3.event)); })
.on('mousedown', () => { d3.event.stopPropagation(); }); .on('mousedown', () => { d3.event.stopPropagation(); });
// render bar annotations, its all hardcoded // render bar annotations, its all hardcoded
@ -104,8 +105,9 @@ export class ChartwerkBarPod extends ChartwerkPod<BarSerie, BarOptions> {
return this.getTrianglePath(x, y, this.barWidth, options); return this.getTrianglePath(x, y, this.barWidth, options);
}) })
.attr('fill', annotation.color) .attr('fill', annotation.color)
.on('mouseover', (e) => { this.overlay.node().dispatchEvent(new MouseEvent(d3.event.type, d3.event)); }) .on('mouseover', () => { this.overlay.node().dispatchEvent(new MouseEvent(d3.event.type, d3.event)); })
.on('mousemove', (e) => { this.overlay.node().dispatchEvent(new MouseEvent(d3.event.type, d3.event)); }) .on('mousemove', () => { this.overlay.node().dispatchEvent(new MouseEvent(d3.event.type, d3.event)); })
.on('mouseout', () => { this.overlay.node().dispatchEvent(new MouseEvent(d3.event.type, d3.event)); })
.on('mousedown', () => { d3.event.stopPropagation(); }); .on('mousedown', () => { d3.event.stopPropagation(); });
}); });
} }

Loading…
Cancel
Save