Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_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
}
_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
}
.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();
});
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())
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'),
constructor () {
this.addresses = map()
this.entities = map()
this.outgoingLinks = map()
this.notesStore = map()
this.tagsStore = map()
}
/**
constructor () {
this.addresses = map()
this.entities = map()
this.outgoingLinks = map()
this.notesStore = map()
this.tagsStore = map()
}
/**
constructor () {
this.addresses = map()
this.entities = map()
this.outgoingLinks = map()
this.notesStore = map()
this.tagsStore = map()
}
/**
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));
});
}
/**
constructor (id) {
super()
this.id = id
this.nodes = map()
}
serialize () {