-
Notifications
You must be signed in to change notification settings - Fork 3
TreeMap
Tuan Nguyen edited this page Mar 12, 2021
·
7 revisions
var bgExpression = "if(ctx.dataset.data[ctx.dataIndex])";
bgExpression += "{var value = ctx.dataset.data[ctx.dataIndex].v;}";
bgExpression += "else{alpha = 1;}; var alpha = (value + 3) / 10;";
bgExpression += "return Color('blue').alpha(alpha).rgbString();";
var data = {
type: 'treemap',
data: {
datasets: [{
label: 'Basic treemap',
tree: [6,6,5,4,3,2,2,1],
fontColor: '#000',
fontFamily: 'serif',
fontSize: 12,
fontStyle: 'normal',
backgroundColor: {
isFunction: true,
params: ['ctx'],
expression: bgExpression
}
}]
}
}
//Initialize the chart by using setData
elements.chart.setData(data);