How to use the d3-hierarchy.treemapSquarify.ratio function in d3-hierarchy

To help you get started, we’ve selected a few d3-hierarchy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github insideout10 / wordlift-plugin / src-js / screens / Admin / screens / SearchRankings / components / Treemap.js View on Github external
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);
}
github apache-superset / superset-ui-plugins / packages / superset-ui-legacy-plugin-chart-treemap / src / Treemap.js View on Github external
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')