Open stockiNail opened 2 years ago
This would probably be best done together with #122, by moving buildData
to parse
and using the parsed data in updateElement
.
I agree. I thought several times to that (I did some tests for me to understand how parse method it's working). There are a couple of "issues" that we have to share:
borderWidth
and captions
) because there are needed to calculated the space and then the values of the element.updateElements
) for the real calculation of the element size.Furthermore, if the parse method will only parse the data, normalizing those, probably we need to maintain the hierarchy, needed in updateElements
(for instance the parent or children of parsed data, not the original data). I didn't check it (I was busy in last days).
@kurkle to address better the options topic, do you think we could implement a configure method where the controller options have got a different scopes hierarchy? Now, they are using 'datasets.treemap', ''
, adding 'datasets.treemap', 'elements.treemap', ''
we could access to the element options resolving to the element config (like captions, spacing, rtl, borderWidth, needed in buildData phase).
Fro @kurkle https://github.com/kurkle/chartjs-chart-treemap/pull/121#issuecomment-1258534332
Remove
tree
option to pass the data to the chart but onlydata
option, like all other charts.