How to use the @vx/hierarchy.stratify function in @vx/hierarchy

To help you get started, we’ve selected a few @vx/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 hshoff / vx / packages / vx-demo / src / components / tiles / treemap.js View on Github external
treemapSliceDice,
} from '@vx/hierarchy';
import { shakespeare } from '@vx/mock-data';

import { scaleLinear } from '@vx/scale';

const blue = '#0373d9';
const green = '#00ff70';
const bg = '#3436b8';

const colorScale = scaleLinear({
  domain: [0, Math.max(...shakespeare.map(d => d.size || 0))],
  range: [blue, green],
});

const data = stratify()
  .id(d => d.id)
  .parentId(d => d.parent)(shakespeare)
  .sum(d => d.size || 0);

const tileMethods = {
  treemapSquarify,
  treemapBinary,
  treemapDice,
  treemapResquarify,
  treemapSlice,
  treemapSliceDice,
};

export default class extends React.Component {
  state = {
    tileMethod: 'treemapSquarify',

@vx/hierarchy

vx tree

MIT
Latest version published 4 years ago

Package Health Score

73 / 100
Full package analysis

Popular @vx/hierarchy functions