diff --git a/src/charts/Treemap.js b/src/charts/Treemap.js index 55eceb03c..a61169b04 100644 --- a/src/charts/Treemap.js +++ b/src/charts/Treemap.js @@ -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, diff --git a/src/modules/dimensions/Dimensions.js b/src/modules/dimensions/Dimensions.js index ffa303138..bb8086f93 100644 --- a/src/modules/dimensions/Dimensions.js +++ b/src/modules/dimensions/Dimensions.js @@ -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) }