Skip to content

Commit aade4fc

Browse files
committed
fixes #1925; log series datalabels in bar chart
1 parent 9b74258 commit aade4fc

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/charts/common/bar/DataLabels.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export default class BarDataLabels {
8686
height: 0,
8787
}
8888
if (w.config.dataLabels.enabled) {
89-
const yLabel = this.barCtx.series[i][j]
89+
const yLabel = w.globals.series[i][j]
9090

9191
textRects = graphics.getTextRects(
9292
w.globals.yLabelFormatters[0](yLabel),
@@ -127,15 +127,15 @@ export default class BarDataLabels {
127127
cy: dataLabelsPos.bcy,
128128
cx: dataLabelsPos.bcx,
129129
j,
130-
val: series[i][j],
130+
val: w.globals.series[i][j],
131131
barHeight,
132132
barWidth,
133133
})
134134

135135
dataLabels = this.drawCalculatedDataLabels({
136136
x: dataLabelsPos.dataLabelsX,
137137
y: dataLabelsPos.dataLabelsY,
138-
val: this.barCtx.isRangeBar ? [y1, y2] : series[i][j],
138+
val: this.barCtx.isRangeBar ? [y1, y2] : w.globals.series[i][j],
139139
i: realIndex,
140140
j,
141141
barWidth,
@@ -242,7 +242,7 @@ export default class BarDataLabels {
242242
dataLabelsX + textRects.height / 2 - strokeWidth / 2 - offsetDLX
243243
}
244244

245-
let valIsNegative = this.barCtx.series[i][j] < 0
245+
let valIsNegative = w.globals.series[i][j] < 0
246246

247247
let newY = y
248248
if (this.barCtx.isReversed) {
@@ -332,11 +332,11 @@ export default class BarDataLabels {
332332

333333
totalDataLabelsX =
334334
totalDataLabelsBcx +
335-
(w.globals.isXNumeric
336-
? -barWidth * w.globals.barGroups.length / 2
337-
: w.globals.barGroups.length * barWidth / 2
338-
- (w.globals.barGroups.length - 1) * barWidth
339-
- xDivision) +
335+
(w.globals.isXNumeric
336+
? (-barWidth * w.globals.barGroups.length) / 2
337+
: (w.globals.barGroups.length * barWidth) / 2 -
338+
(w.globals.barGroups.length - 1) * barWidth -
339+
xDivision) +
340340
barTotalDataLabelsConfig.offsetX
341341
}
342342

@@ -396,7 +396,7 @@ export default class BarDataLabels {
396396
let totalDataLabelsY
397397
let totalDataLabelsAnchor = 'start'
398398

399-
let valIsNegative = this.barCtx.series[i][j] < 0
399+
let valIsNegative = w.globals.series[i][j] < 0
400400

401401
let newX = x
402402
if (this.barCtx.isReversed) {

0 commit comments

Comments
 (0)