Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function bind(el, props) {
const adapter = new TreemapAdapter(
new TilingStrategy(
props.minTileWidth,
props.minTileHeight,
treemapSquarify.ratio(1.61),
scoreFn
),
RenderStrategy(el, props.tileRenderCallback),
scoreFn
);
adapter.load(props.url);
}
const formatNumber = getNumberFormatter(numberFormat);
const colorFn = CategoricalColorNamespace.getScale(colorScheme);
const rootNodes = rawData;
div.selectAll('*').remove();
if (rootNodes.length > 0) {
const [rootNode] = rootNodes;
const treemap = d3Treemap()
.size([width, height])
.paddingOuter(3)
.paddingTop(19)
.paddingInner(1)
.tile(treemapSquarify.ratio(treemapRatio))
.round(true);
const root = treemap(
d3Hierarchy(rootNode)
.sum(d => d.value)
.sort((a, b) => b.height - a.height || b.value - a.value),
);
const svg = div
.append('svg')
.attr('class', 'treemap')
.attr('width', width)
.attr('height', height);
const cell = svg
.selectAll('.node')