Skip to content

Commit

Permalink
Merge pull request #4646 from cocarmon/fix/4645
Browse files Browse the repository at this point in the history
Fix issue 4645
  • Loading branch information
junedchhipa authored Aug 17, 2024
2 parents c69f253 + 8929322 commit 476df9e
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/charts/common/treemap/Helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,22 @@ export default class TreemapHelpers {
let utils = new Utils()

if (w.config.plotOptions[chartType].enableShades) {
// The shadeColor function may return either an RGB or a hex color value
// However, hexToRgba requires the input to be in hex format
// The ternary operator checks if the color is in RGB format, and if so, converts it to hex
if (this.w.config.theme.mode === 'dark') {
const shadeColor = utils.shadeColor(
colorShadePercent * -1,
colorProps.color
)
color = Utils.hexToRgba(
utils.shadeColor(colorShadePercent * -1, colorProps.color),
Utils.isColorHex(shadeColor) ? shadeColor : Utils.rgb2hex(shadeColor),
w.config.fill.opacity
)
} else {
const shadeColor = utils.shadeColor(colorShadePercent, colorProps.color)
color = Utils.hexToRgba(
utils.shadeColor(colorShadePercent, colorProps.color),
Utils.isColorHex(shadeColor) ? shadeColor : Utils.rgb2hex(shadeColor),
w.config.fill.opacity
)
}
Expand Down Expand Up @@ -132,7 +140,7 @@ export default class TreemapHelpers {
return {
color,
foreColor,
percent
percent,
}
}

Expand All @@ -148,7 +156,7 @@ export default class TreemapHelpers {

if (dataLabelsConfig.enabled) {
elDataLabelsWrap = graphics.group({
class: 'apexcharts-data-labels'
class: 'apexcharts-data-labels',
})

const offX = dataLabelsConfig.offsetX
Expand All @@ -167,7 +175,7 @@ export default class TreemapHelpers {
color: colorProps.foreColor,
parent: elDataLabelsWrap,
fontSize,
dataLabelsConfig
dataLabelsConfig,
})
}

Expand Down

0 comments on commit 476df9e

Please sign in to comment.