How to use the @vx/mock-data.genStats function in @vx/mock-data

To help you get started, we’ve selected a few @vx/mock-data 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 / components / tiles / boxplot.js View on Github external
import { LinearGradient } from '@vx/gradient';
import { Group } from '@vx/group';
import { genStats } from '@vx/mock-data';
import { PatternLines } from '@vx/pattern';
import { scaleBand, scaleLinear } from '@vx/scale';
import { BoxPlot, ViolinPlot } from '@vx/stats';
import { Tooltip, withTooltip } from '@vx/tooltip';
import { format } from 'd3-format';
import React from 'react';

const data = genStats(5);
const twoDecimalFormat = format('.2f');

// accessors
const x = d => d.boxPlot.x;
const min = d => d.boxPlot.min;
const max = d => d.boxPlot.max;
const median = d => d.boxPlot.median;
const firstQuartile = d => d.boxPlot.firstQuartile;
const thirdQuartile = d => d.boxPlot.thirdQuartile;
const outliers = d => d.boxPlot.outliers;

export default withTooltip(
  ({
    width,
    height,
    events = false,
github williaster / data-ui / packages / demo / examples / 01-xy-chart / data.js View on Github external
r: minSize + Math.random() * (maxSize - minSize),
    fillOpacity: Math.max(0.4, Math.random()),
    fill: theme.colors.categories[i % 2 === 0 ? 1 : 3],
  }))
  .concat(
    Array(70)
      .fill(null)
      .map((_, i) => ({
        x: start,
        r: minSize + Math.random() * (maxSize - minSize),
        fillOpacity: Math.max(0.4, Math.random()),
        fill: theme.colors.categories[i % 2 === 0 ? 1 : 3],
      })),
  );

export const statsData = genStats(5);