Skip to content

Commit

Permalink
fixes #4635; treemap datalabels printed for 0 values
Browse files Browse the repository at this point in the history
  • Loading branch information
junedchhipa committed Aug 13, 2024
1 parent 9a3c713 commit cad1d2f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
24 changes: 14 additions & 10 deletions src/charts/Treemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,20 @@ export default class TreemapChart {
y2
)
}
let dataLabels = this.helpers.calculateDataLabels({
text: formattedText,
x: (x1 + x2) / 2,
y: (y1 + y2) / 2 + this.strokeWidth / 2 + fontSize / 3,
i,
j,
colorProps,
fontSize,
series,
})
let dataLabels = null

if (w.globals.series[i][j]) {
dataLabels = this.helpers.calculateDataLabels({
text: formattedText,
x: (x1 + x2) / 2,
y: (y1 + y2) / 2 + this.strokeWidth / 2 + fontSize / 3,
i,
j,
colorProps,
fontSize,
series,
})
}
if (w.config.dataLabels.enabled && dataLabels) {
this.rotateToFitLabel(
dataLabels,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/dimensions/Dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default class Dimensions {
translateY = 0
}

if (!this.isSparkline) {
if (!this.isSparkline && w.config.chart.type !== 'treemap') {
this.dimXAxis.additionalPaddingXLabels(xaxisLabelCoords)
}

Expand Down

0 comments on commit cad1d2f

Please sign in to comment.