Skip to content

Commit

Permalink
fix: use column index for positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
mxposed committed Jul 3, 2023
1 parent b7c0a77 commit ca0bd38
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,10 @@ class FHeatmap {
abcCounter += 1;
});

this.columnInfo.forEach(column => {
this.columnInfo.forEach((column, i) => {
const el = labels.append('g')
.attr('transform', `rotate(${-O.columnRotate})`)
.classed(`column-${column.id}`, true);
.classed(`column-${i}`, true);
el.append('text')
.attr('x', 0)
.attr('y', 0)
Expand Down Expand Up @@ -355,16 +355,16 @@ class FHeatmap {
bodyWidth = column.offset + width + O.padding;
}
});
this.columnInfo.forEach(column => {
this.columnInfo.forEach((column, i) => {
let center = column.offset + column.widthPx / 2;
let rotate = column.rotate ? -O.columnRotate : 0;
this.header.select(`.column-${column.id}`)
this.header.select(`.column-${i}`)
.attr(
'transform',
`translate(${center}, ${headerHeight - 2 * O.padding}) rotate(${rotate})`
);
if (!column.rotate) {
labels.select(`.column-${column.id} text`)
labels.select(`.column-${i} text`)
.attr('text-anchor', 'middle');
} else {
labels.append('line')
Expand Down

0 comments on commit ca0bd38

Please sign in to comment.