# Using Datalabels plugin

const config = {
  type: 'treemap',
  data: {
    datasets: [
      {
        label: 'My First dataset',
        tree: Utils.numbers(NUMBER_CFG),
        borderColor: (ctx) => colorFromRaw(ctx, true),
        borderWidth: 1,
        spacing: 0,
        backgroundColor: (ctx) => colorFromRaw(ctx),
        datalabels: {
          display: 'auto',
          anchor: 'start',
          align: 45,
          formatter: (value) => Math.trunc(value.v),
          color: 'white',
          font: {
            size: 20
          }
        }
      }
    ],
  },
  options: {
    plugins: {
      datalabels: {
        display: true,
      }
    }
  }
};
Last Updated: 11/13/2023, 6:13:46 PM