You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Property 'data' is missing in type '{ label: string; tree: number[]; borderColor: string; borderWidth: number; spacing: number; backgroundColor: string; }' but required in type 'ChartDatasetProperties<"treemap", TreemapDataPoint[]>'
This kind of "contradicts" the documentation which states that data would be automatically populated/built...
It requires me to set it up as an empty array otherwise it will error out on me (it may be my linting settings?)
Once it's set up, the error goes away and everything works properly (ignore the bright red, it's my fault):
So, is this an implementation issue or documentation issue. Or worse, a user issue 😶.
The text was updated successfully, but these errors were encountered:
The issue is a typings one. The data array requirement originates from chart.js and I'm not sure it can be changed externally.
The documentation is correct in the aspect that the data array will be populated and is not strictly required by the code, but typings just don't agree. You could use a @ts-ignore or @ts-expect-error comment to suppress the type error, but I'd recommend your already working approach of just providing the empty data array to satisfy the types too.
I was trying to implement a sample treemap graph to test and then fully implement it in an application.
My application is React based using:
Here's how I was trying to set it up:
However, unless I set data: []:
I get errors at the chart call (around line 64):
The error:
Property 'data' is missing in type '{ label: string; tree: number[]; borderColor: string; borderWidth: number; spacing: number; backgroundColor: string; }' but required in type 'ChartDatasetProperties<"treemap", TreemapDataPoint[]>'
This kind of "contradicts" the documentation which states that data would be automatically populated/built...
It requires me to set it up as an empty array otherwise it will error out on me (it may be my linting settings?)
Once it's set up, the error goes away and everything works properly (ignore the bright red, it's my fault):
![image](https://private-user-images.githubusercontent.com/114450012/275984775-949a05f4-3c89-477f-9d05-e7010e312043.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNDYwMDQsIm5iZiI6MTczOTA0NTcwNCwicGF0aCI6Ii8xMTQ0NTAwMTIvMjc1OTg0Nzc1LTk0OWEwNWY0LTNjODktNDc3Zi05ZDA1LWU3MDEwZTMxMjA0My5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOFQyMDE1MDRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mM2Q4ZDM3ZWRlOWI2NGIwYjI4ZDA1NzhkMGMyMGI4MThlZTg1MzVhYjM5ZWRkNzdhMjMyZTcwYzJmNDY1NTJmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.VG_Eipx8NVDxDPk0bQ2HYr_FtqGm9D1MDKGuvZmhYOo)
So, is this an implementation issue or documentation issue. Or worse, a user issue 😶.
The text was updated successfully, but these errors were encountered: