Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue 4645 #4646

Merged
merged 1 commit into from
Aug 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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