Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ticks: tickArguments, tickValues: tickValuesProp,
tickStroke, tickStrokeOpacity, tickInterval, tickIntervalFunction
} = props;
// if (tickArguments) tickArguments = [tickArguments];
let tickValues;
if (isDefined(tickValuesProp)) {
if (typeof tickValuesProp === "function") {
tickValues = tickValuesProp(scale.domain());
} else {
tickValues = tickValuesProp;
}
} else if (isDefined(tickInterval)) {
const [min, max] = scale.domain();
const baseTickValues = d3Range(min, max, (max - min) / tickInterval);
tickValues = tickIntervalFunction
? tickIntervalFunction(min, max, tickInterval)
: baseTickValues;
} else if (isDefined(scale.ticks)) {
tickValues = scale.ticks(tickArguments, flexTicks);
} else {
tickValues = scale.domain();
}
const baseFormat = scale.tickFormat
? scale.tickFormat(tickArguments)
: identity;
const format = isNotDefined(tickFormat)
? baseFormat
const { domain, range, onChange } = this.props;
if (domain.length === range.length) {
return;
}
const rangeMin = range[0];
const rangeMax = range[range.length - 1];
const step = Math.round(1000 * ((rangeMax - rangeMin) / (domain.length - 1))) / 1000;
let matched;
// non-number solution - just copy the last element or truncate the array
if (isNaN(step)) {
const numToAdd = domain.length - range.length;
if (numToAdd > 0) { // adding elements
matched = [...range, ...d3Range(numToAdd).map(() => range[range.length - 1])];
} else { // removing elements
matched = range.slice(0, domain.length);
}
} else {
matched = d3Range(rangeMin, rangeMax, step).concat(rangeMax);
}
onChange(matched);
}
render() {
const numTokens = this.props.numTokens
const totalSupply = this.props.totalSupply
let maxTotalSupply = (totalSupply + numTokens) > totalSupply * 2 ? (totalSupply + numTokens) * 1.3 : (totalSupply || 10) * 2
maxTotalSupply = maxTotalSupply < 10 ? 10 : maxTotalSupply
const numberOfDataPoints = 200
const exponent = this.props.exponent
let data = range(0, maxTotalSupply, maxTotalSupply / numberOfDataPoints / 2)
data.push(maxTotalSupply)
let supplyData = range(0, totalSupply, totalSupply / numberOfDataPoints / 2)
supplyData.push(totalSupply)
let txData
const step = numTokens / numberOfDataPoints
if (this.props.isMint) {
txData = range(totalSupply, totalSupply + numTokens, step)
txData.push(totalSupply + numTokens)
} else {
txData = range(totalSupply - numTokens, totalSupply, step)
txData.push(totalSupply)
}
const price = (supply: number) => Math.pow(supply, exponent)
const x = scaleLinear().domain([0, maxTotalSupply]).range([0, this.state.width])
const y = scaleLinear().domain([price(maxTotalSupply), 0]).range([0, this.props.height])
handleMatchRange() {
const { domain, range, onChange } = this.props;
const domainMin = domain[0];
const domainMax = domain[domain.length - 1];
const step = Math.round(1000 * ((domainMax - domainMin) / (range.length - 1))) / 1000;
const matched = d3Range(domainMin, domainMax, step).concat(domainMax);
onChange(matched);
}
renderColorBar() {
const interpolatorColors = range(0, 1, 0.01).map(t => this.props.interpolator(t));
this.colorBar = renderComponent(this.colorBar, ColorBar, this.root.node(), {
colors: interpolatorColors,
});
}
function getRandomColor() {
return range(6).reduce((m) => {
return `${m}${'0123456789ABCDEF'[Math.floor(Math.random() * 16)]}`;
}, '#');
}
strokeWidth={1}
reference={tooltipData.index}
stroke={allColors.pink[6]}
strokeDasharray="4 4"
/>,
,
]}
)}
))(range(40).map(() => Math.random() * (Math.random() > 0.2 ? 1 : 2)))}
Math.random() * (Math.random() > 0.2 ? 1 : 2))}
>
export function getDefaultColors(): string[] {
return range(20)
.map(number => number.toString())
.map(scaleOrdinal(schemeCategory10));
}
const randomData = n => range(n).map(() => Math.random() * (Math.random() > 0.2 ? 1 : 2));