How to use the @vx/scale.scalePoint function in @vx/scale

To help you get started, we’ve selected a few @vx/scale 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 williaster / data-ui / packages / event-flow / src / utils / scale-utils.js View on Github external
export function computeEntityNameScale(sequences, heightPerEntity = 30) {
  const domain = sequences.map(sequence => sequence[0] && sequence[0][ENTITY_ID]);
  const height = sequences.length * heightPerEntity;

  const scale = scalePoint({
    clamp: true,
    range: [0, height],
    padding: 0.2,
    domain,
  });

  return {
    scale,
    accessor: d => d[ENTITY_ID],
    label: 'Entity id',
  };
}