|
|
@ -62,23 +62,23 @@ export class ChartwerkBarPod extends ChartwerkPod<BarSerie, BarOptions> { |
|
|
|
.each((d: RowValues, i: number, nodes: any) => { |
|
|
|
.each((d: RowValues, i: number, nodes: any) => { |
|
|
|
const container = d3.select(nodes[i]); |
|
|
|
const container = d3.select(nodes[i]); |
|
|
|
container.selectAll('rect') |
|
|
|
container.selectAll('rect') |
|
|
|
.data(d.values) |
|
|
|
.data(d.values) |
|
|
|
.enter().append('rect') |
|
|
|
.enter().append('rect') |
|
|
|
.style('fill', (val, i) => d.colors[i]) |
|
|
|
.style('fill', (val, i) => d.colors[i]) |
|
|
|
.attr('opacity', () => this.getBarOpacity(d)) |
|
|
|
.attr('opacity', () => this.getBarOpacity(d)) |
|
|
|
.attr('x', (val: number, idx: number) => { |
|
|
|
.attr('x', (val: number, idx: number) => { |
|
|
|
return this.getBarPositionX(d.key, idx); |
|
|
|
return this.getBarPositionX(d.key, idx); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.attr('y', (val: number, idx: number) => { |
|
|
|
.attr('y', (val: number, idx: number) => { |
|
|
|
return this.getBarPositionY(val, idx, d.values); |
|
|
|
return this.getBarPositionY(val, idx, d.values); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.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', this.redirectEventToOverlay.bind(this)) |
|
|
|
.on('mouseover', this.redirectEventToOverlay.bind(this)) |
|
|
|
.on('mousemove', this.redirectEventToOverlay.bind(this)) |
|
|
|
.on('mousemove', this.redirectEventToOverlay.bind(this)) |
|
|
|
.on('mouseout', this.redirectEventToOverlay.bind(this)) |
|
|
|
.on('mouseout', this.redirectEventToOverlay.bind(this)) |
|
|
|
.on('mousedown', () => { d3.event.stopPropagation(); }); |
|
|
|
.on('mousedown', () => { d3.event.stopPropagation(); }); |
|
|
|
|
|
|
|
|
|
|
|
// render bar annotations, its all hardcoded
|
|
|
|
// render bar annotations, its all hardcoded
|
|
|
|
if(_.isEmpty(this.options.barOptions.annotations)) { |
|
|
|
if(_.isEmpty(this.options.barOptions.annotations)) { |
|
|
|