For example, the dataLabel fontSize of AAPL should be much larger than current size.
I tried to 'formatter' and callback function but it doesn't read the 'point'.
Can you help me what I have to do?
Code: Select all
series: [{
data: treemapData,
type: 'treemap',
levels: [{
level: 1,
dataLabels: {
style: {
fontSize: '15px',
},
format: '{point.name}'
}
},{
level: 2,
dataLabels: {
formatter: function() {
return adjustTextPosition(this.point);
},
style: {
fontSize: {
formatter: function(){
return adjustTextSize(this.point)
}
}
},
}
}],
Code: Select all
const adjustTextPosition = (point) => {
const width = point.shapeArgs.width;
const height = point.shapeArgs.height;
if(width + height > 200) {
return `${point.name}`
}
}
Code: Select all
const adjustTextSize = (point) => {
const width = point.shapeArgs.width;
const height = point.shapeArgs.height;
if(width + height > 200) {
return point.series.options.dataLabels.style.fontSize == '30'
}
}