Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
}
});
}
var eventTypes = ['render', 'resize', 'highlight', 'mark', 'brush', 'brushend', 'brushstart', 'axesreorder'].concat(keys(config));
var events = dispatch.apply(_this$4, eventTypes),
flags = {
brushable: false,
reorderable: false,
axes: false,
interactive: false,
debug: false
},
xscale = scalePoint(),
dragging = {},
axis = axisLeft().ticks(5),
ctx = {},
canvas = {};
var brush = {
modes: {
None: {
install: function install(pc) {}, // Nothing to be done.
uninstall: function uninstall(pc) {}, // Nothing to be done.
selected: function selected() {
return [];
}, // Nothing to return
brushState: function brushState() {
return {};
}
getXScale(domain, width): any {
switch (this.scaleType) {
case 'time':
return scaleTime()
.range([0, width])
.domain(domain);
case 'linear':
const scale = scaleLinear()
.range([0, width])
.domain(domain);
return this.roundDomains ? scale.nice() : scale;
default:
return scalePoint()
.range([0, width - twoPI / domain.length])
.padding(0)
.domain(domain);
}
}
getXScale() {
let scale;
if (this.scaleType === 'time') {
scale = scaleTime()
.range([0, this.dims.width])
.domain(this.xDomain);
} else if (this.scaleType === 'linear') {
scale = scaleLinear()
.range([0, this.dims.width])
.domain(this.xDomain);
} else if (this.scaleType === 'ordinal') {
scale = scalePoint()
.range([0, this.dims.width])
.padding(0.1)
.domain(this.xDomain);
}
return scale;
}
getXScale() {
let scale;
if (this.scaleType === 'time') {
scale = scaleTime()
.range([0, this.dims.width])
.domain(this.xDomain);
} else if (this.scaleType === 'linear') {
scale = scaleLinear()
.range([0, this.dims.width])
.domain(this.xDomain);
} else if (this.scaleType === 'ordinal') {
scale = scalePoint()
.range([0, this.dims.width])
.padding(0.1)
.domain(this.xDomain);
}
return scale;
}
export function pointScale([domain, range], hash) {
let scale = guidDomainScale(scalePoint());
addOptionsToOrdinalScale(scale, domain, range, hash, 'point');
return scale;
}
let scale;
if (this.scaleType === 'time') {
scale = scaleTime()
.range([0, width])
.domain(domain);
} else if (this.scaleType === 'linear') {
scale = scaleLinear()
.range([0, width])
.domain(domain);
if (this.roundDomains) {
scale = scale.nice();
}
} else if (this.scaleType === 'ordinal') {
scale = scalePoint()
.range([0, width])
.padding(0.1)
.domain(domain);
}
return scale;
}
export function createScaleTextY(domain = [], s = 0) {
return scalePoint()
.domain(domain)
.range([0, s])
.padding(0);
}
getXScale(domain, width): any {
let scale;
if (this.scaleType === 'time') {
scale = scaleTime();
} else if (this.scaleType === 'linear') {
scale = scaleLinear();
} else if (this.scaleType === 'ordinal') {
scale = scalePoint().padding(0.1);
}
scale.range([0, width]).domain(domain);
return this.roundDomains ? scale.nice() : scale;
}
}
if (this.scaleType === 'time') {
scale = scaleTime()
.range([0, width])
.domain(domain);
} else if (this.scaleType === 'linear') {
scale = scaleLinear()
.range([0, width])
.domain(domain);
if (this.roundDomains) {
scale = scale.nice();
}
} else if (this.scaleType === 'ordinal') {
scale = scalePoint()
.range([this.bandwidth / 2, width - this.bandwidth / 2])
.domain(domain);
}
return scale;
}