How to use the d3-array.shuffle function in d3-array

To help you get started, we’ve selected a few d3-array 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 DefinitelyTyped / DefinitelyTyped / d3-array / d3-array-tests.ts View on Github external
more: [10, 30, 40]
};

const x: Array = d3Array.permute(testObject, ['name', 'val', 'when', 'more']);

// range() ---------------------------------------------------------------------

numbersArray = d3Array.range(10);
numbersArray = d3Array.range(1, 10);
numbersArray = d3Array.range(1, 10, 0.5);

// shuffle() -------------------------------------------------------------------

mergedArray = d3Array.shuffle(mergedArray);

mergedArray = d3Array.shuffle(mergedArray, 1);

mergedArray = d3Array.shuffle(mergedArray, 1, 3);

// ticks() ---------------------------------------------------------------------

numbersArray = d3Array.ticks(1, 10, 5);

// tickStep() ------------------------------------------------------------------

numbersArray = d3Array.tickStep(1, 10, 5);

// transpose() -----------------------------------------------------------------

testArrays = d3Array.transpose([
    [
        new MixedObject(10, new Date(2016, 6, 1)),
github DefinitelyTyped / DefinitelyTyped / d3-array / d3-array-tests.ts View on Github external
name: 'Test',
    when: new Date(),
    more: [10, 30, 40]
};

const x: Array = d3Array.permute(testObject, ['name', 'val', 'when', 'more']);

// range() ---------------------------------------------------------------------

numbersArray = d3Array.range(10);
numbersArray = d3Array.range(1, 10);
numbersArray = d3Array.range(1, 10, 0.5);

// shuffle() -------------------------------------------------------------------

mergedArray = d3Array.shuffle(mergedArray);

mergedArray = d3Array.shuffle(mergedArray, 1);

mergedArray = d3Array.shuffle(mergedArray, 1, 3);

// ticks() ---------------------------------------------------------------------

numbersArray = d3Array.ticks(1, 10, 5);

// tickStep() ------------------------------------------------------------------

numbersArray = d3Array.tickStep(1, 10, 5);

// transpose() -----------------------------------------------------------------

testArrays = d3Array.transpose([
github sghall / resonance / docs / src / routes / documentation / NodeGroup / Example4.js View on Github external
value: 19,
  },
];

// **************************************************
//  Example
// **************************************************
class Example extends PureComponent {
  constructor(props) {
    super(props);

    (this:any).update = this.update.bind(this);
  }

  state = {
    data: shuffle(mockData).slice(0, Math.floor(Math.random() * ((mockData.length + 2) - (5 + 1))) + 5),
  }

  update() {
    this.setState({
      data: shuffle(mockData).slice(0, Math.floor(Math.random() * ((mockData.length + 2) - (5 + 1))) + 5),
    });
  }

  render() {
    const scale = scaleBand()
      .rangeRound([0, dims[0]])
      .domain(this.state.data.map((d) => d.name))
      .padding(0.1);

    return (
      <div></div>
github react-tools / react-move / docs / src / pages / demos / simple / Circles.js View on Github external
value: 12,
  }, {
    name: 'Oyoba',
    value: 69,
  }, {
    name: 'Ntags',
    value: 17,
  },
]

// **************************************************
//  Example
// **************************************************
class Example extends PureComponent {
  state = {
    data: shuffle(mockData).slice(0, Math.floor(Math.random() * ((mockData.length + 2) - (5 + 1))) + 5),
  }

  update = () =&gt; {
    this.setState({
      data: shuffle(mockData).slice(0, Math.floor(Math.random() * ((mockData.length + 2) - (5 + 1))) + 5),
    })
  }

  render() {
    const scale = scaleBand()
      .rangeRound([0, dims[0]])
      .domain(this.state.data.map((d) =&gt; d.name))
      .padding(0.1)

    return (
      <div></div>
github dantrain / react-stonecutter / src / demos / Spring.jsx View on Github external
generateData() {
    return d3Array.shuffle(alphabet)
      .slice(0, this.props.minItems +
        Math.floor(Math.random() * (26 - this.props.minItems)))
      .sort()
      .map(letter => ({
        letter,
        number: Math.floor(Math.random() * 100)
      }));
  },
github react-tools / react-move / docs / src / routes / examples / Charts / DonutChart1.js View on Github external
function getArcs() {
  const data = shuffle(mockData)
    .map(({ name }) => ({ name, value: getRandom(10, 100) }));

  return pieLayout(sortBy(data, (d) => d.name));
}
github sghall / resonance / docs / src / pages / demos / node-group / Example2.js View on Github external
function getData() {
  return shuffle(range(count).map((d) => ({ value: d }))).slice(0, count / 1.5)
}
github orbiting / republik-frontend / pages / meta.js View on Github external
static async getInitialProps() {
    return {
      galleryItems: shuffle(gallery)
    }
  }
  constructor(props) {
github dantrain / react-stonecutter / src / demos / CSS.jsx View on Github external
generateData() {
    return d3Array.shuffle(alphabet)
      .slice(0, this.props.minItems +
        Math.floor(Math.random() * (26 - this.props.minItems)))
      .sort()
      .map(letter => ({
        letter,
        number: Math.floor(Math.random() * 100)
      }));
  },
github react-tools / react-move / docs / src / pages / demos / charts / DonutChart1.js View on Github external
function getArcs() {
  const data = shuffle(mockData)
    .map(({ name }) => ({ name, value: getRandom(10, 100) }))

  return pieLayout(sortBy(data, (d) => d.name))
}