How to use d3-collection - 10 common examples

To help you get started, we’ve selected a few d3-collection 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 broadinstitute / gtex-viz / src / modules / Heatmap.js View on Github external
_setXScale(width, newList = undefined) {
        if(newList !== undefined){
            this.xList = newList
        }
        else {
            this.xList = nest()
                .key((d) => d.x)
                .entries(this.data)
                .map((d) => d.key);
        }
        this.xScale = scaleBand()
            .domain(this.xList)
            .range([0, width])
            .padding(.05); // TODO: eliminate hard-coded value
    }
github broadinstitute / gtex-viz / src / modules / HalfMap.js View on Github external
_setXScale(dim={w:600}, xList=undefined){
        if (xList === undefined){
            xList = nest()
            .key((d) => d.x) // group this.data by d.x
            .entries(this.data)
            .map((d) => d.key) // then return the unique list of d.x
            .sort((a, b) => {return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;});
        }

        this.xScale = scaleBand() // reference: https://github.com/d3/d3-scale#scaleBand
            .domain(xList) // perhaps it isn't necessary to store xList, it could be retrieved by xScale.domain
            // .range([dim.left, dim.left+(dim.w/Math.sqrt(2))])
            .range([0, dim.w/Math.sqrt(2)])
            .padding(.05); // temporarily hard-coded value
    }
github CreatingData / deepscatter / src / deepscatter.js View on Github external
.then((data) => {
        const lab = [];
        const col = {};
        keys(data[0])
          .filter(k => ['x', 'y', 'htid', 'id', 'zoom', 'ix', 'Xwidths', 'quadrant', 'base_zoom'].indexOf(k) === -1)
          .forEach((k) => {
            col[k] = {};
            lab.push(k);
          });
        colorscheme = col;
        color_labels = lab;
        //        that.redraw();
      });
github graphsense / graphsense-dashboard / src / nodeGraph.js View on Github external
constructor (dispatcher, labelType, currency, txLabelType) {
    super()
    this.currency = currency
    this.dispatcher = dispatcher
    this.labelType = labelType
    this.txLabelType = txLabelType
    // nodes of the graph
    this.entityNodes = map()
    this.addressNodes = map()
    // ids of addresses/entities present in graph
    this.references = {address: map(), entity: map()}
    this.adding = set()
    this.selectedNode = null
    this.highlightedNodes = []
    this.layers = []
    this.transform = {k: 1, x: 0, y: 0, dx: 0, dy: 0}
    this.colorMapCategories = map()
    this.colorMapTags = map()
    let colorGen = (map, type) => (k) => {
      if (!k) return defaultColor[type]
      let color = map.get(k)
      if (color === undefined) {
        color = colorScale(map.size())
        map.set(k, color.toString())
github graphsense / graphsense-dashboard / src / nodeGraph.js View on Github external
super()
    this.currency = currency
    this.dispatcher = dispatcher
    this.labelType = labelType
    this.txLabelType = txLabelType
    // nodes of the graph
    this.entityNodes = map()
    this.addressNodes = map()
    // ids of addresses/entities present in graph
    this.references = {address: map(), entity: map()}
    this.adding = set()
    this.selectedNode = null
    this.highlightedNodes = []
    this.layers = []
    this.transform = {k: 1, x: 0, y: 0, dx: 0, dy: 0}
    this.colorMapCategories = map()
    this.colorMapTags = map()
    let colorGen = (map, type) => (k) => {
      if (!k) return defaultColor[type]
      let color = map.get(k)
      if (color === undefined) {
        color = colorScale(map.size())
        map.set(k, color.toString())
      }
      let c = hsl(color)
      c.l = c.l * lightnessFactor[type]
      return c
    }
    this.colors =
      {
        'entity': {
          categories: colorGen(this.colorMapCategories, 'entity'),
github graphsense / graphsense-dashboard / src / store.js View on Github external
constructor () {
    this.addresses = map()
    this.entities = map()
    this.outgoingLinks = map()
    this.notesStore = map()
    this.tagsStore = map()
  }
  /**
github graphsense / graphsense-dashboard / src / store.js View on Github external
constructor () {
    this.addresses = map()
    this.entities = map()
    this.outgoingLinks = map()
    this.notesStore = map()
    this.tagsStore = map()
  }
  /**
github graphsense / graphsense-dashboard / src / store.js View on Github external
constructor () {
    this.addresses = map()
    this.entities = map()
    this.outgoingLinks = map()
    this.notesStore = map()
    this.tagsStore = map()
  }
  /**
github quantmind / giotto / src / plugins / transitions.js View on Github external
constructor (paper, opts, defaults) {
        var transitions = map(),
            options = {};
        forEach(opts, (o, key) => {
            if (isObject(o)) transitions.set(key, o);
            else options[key] = o;
        });
        super(paper, options, defaults);
        var scope = this.$scope;
        scope.transitions = map();
        transitions.each((o, key) => {
            scope.transitions.set(key, scope.$new().$extend(o));
        });
    }
    /**
github graphsense / graphsense-dashboard / src / nodeGraph / layer.js View on Github external
constructor (id) {
    super()
    this.id = id
    this.nodes = map()
  }
  serialize () {

d3-collection

Handy data structures for elements keyed by string.

BSD-3-Clause
Latest version published 6 years ago

Package Health Score

55 / 100
Full package analysis