[Chartjs]-I am having this error in charts v3 chartjs-chart-treemap: fontColor does not exist in type 'ChartDataset<"treemap", TreemapDataPoint[]>

1👍

Looking at the documentation of the treemap it doesnt support the fontColor property. To change the color of the labels you need to define it either in:

  • data.datasets[datasetIndex].labels.color
  • options.datasets.treemap.labels.color
  • options.elements.treemap.labels.color

Since it looks like you want it in the dataset, your datasets array would look like this:

datasets: [{
  tree: this.treeData,
  key: 'value',
  groups: ['coin'],
  spacing: 0.5,
  borderWidth: 1.5,
  labels: {
    color: 'black'
  }
  borderColor: "grey"
}],

On a side note your options object is also wrong, you are using V2 syntax in V3, the tooltip and legend config have been moved to the plugins namespace, for all changes you can read the migration guide

Leave a comment