本文整理汇总了TypeScript中d3-scale.scalePow函数的典型用法代码示例。如果您正苦于以下问题:TypeScript scalePow函数的具体用法?TypeScript scalePow怎么用?TypeScript scalePow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scalePow函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createConnectionStrokeWidthRangeScale
export function createConnectionStrokeWidthRangeScale(width: number) {
const rangeMax = CONNECTION_STROKE_WIDTH_RANGE_MAX_SCALE(width);
return scalePow<[number, number]>()
.exponent(2)
.range([[0.5, rangeMax[0]], [1, rangeMax[1]]]);
}
示例2: createPlaceStrokeWidthRangeScale
export function createPlaceStrokeWidthRangeScale(width: number) {
const rangeMin = PLACE_STROKE_WIDTH_RANGE_MIN_SCALE(width);
const rangeMax = PLACE_STROKE_WIDTH_RANGE_MAX_SCALE(width);
return scalePow<[number, number]>()
.exponent(2)
.range([[rangeMin[0], rangeMax[0]], [rangeMin[1], rangeMax[1]]]);
}
示例3: createPlaceRadiusRangeScale
export function createPlaceRadiusRangeScale(width: number) {
const rangeMin = PLACE_RADIUS_RANGE_MIN_SCALE(width);
const rangeMax = PLACE_RADIUS_RANGE_MAX_SCALE(width);
return scalePow<[number, number]>()
.exponent(2)
.range([[rangeMin[0], rangeMax[0]], [rangeMin[1], rangeMax[1]]]);
}
示例4: valueOf
// --------------------------------------------------------------------------
// Test Axis Generators
// --------------------------------------------------------------------------
let topAxis: d3Axis.Axis<number | { valueOf(): number }> = d3Axis.axisTop(scaleLinear());
let rightAxis: d3Axis.Axis<Date> = d3Axis.axisRight<Date>(scaleTime());
let bottomAxis: d3Axis.Axis<string> = d3Axis.axisBottom(scaleOrdinal<number>());
let leftAxis: d3Axis.Axis<number | { valueOf(): number }> = d3Axis.axisLeft(scaleLinear<number>());
// --------------------------------------------------------------------------
// Test Configure Axis
// --------------------------------------------------------------------------
// scale(...) ----------------------------------------------------------------
leftAxis = leftAxis.scale(scalePow());
const powerScale: ScalePower<number, number> = leftAxis.scale<ScalePower<number, number>>();
// powerScale = leftAxis.scale(); // fails, without casting as AxisScale is purposely generic
bottomAxis = bottomAxis.scale(scaleOrdinal<number>());
// bottomAxis = bottomAxis.scale(scalePow()) // fails, domain of scale incompatible with domain of axis
const axisScale: d3Axis.AxisScale<string> = bottomAxis.scale();
const ordinalScale: ScaleOrdinal<string, number> = bottomAxis.scale<ScaleOrdinal<string, number>>();
// ordinalScale = bottomAxis.scale(); // fails, without casting as AxisScale is purposely generic
// ticks(...) ----------------------------------------------------------------
topAxis = topAxis.ticks(20, ',f');
示例5:
// copy(...) -----------------------------------------------------------------
const copiedLinearScale: d3Scale.ScaleLinear<number, string> = linearScaleNumString.copy();
// -------------------------------------------------------------------------------
// Power Scale Factories
// -------------------------------------------------------------------------------
// scalePow() and scaleSqrt() ----------------------------------------------------
let powerScaleNumber: d3Scale.ScalePower<number, number>;
let powerScaleString: d3Scale.ScalePower<string, string>;
let powerScaleNumString: d3Scale.ScalePower<number, string>;
powerScaleNumber = d3Scale.scalePow();
powerScaleString = d3Scale.scalePow<string>();
powerScaleNumString = d3Scale.scalePow<number, string>();
let squarerootScaleNumber: d3Scale.ScalePower<number, number>;
let squarerootScaleString: d3Scale.ScalePower<string, string>;
let squarerootScaleNumString: d3Scale.ScalePower<number, string>;
squarerootScaleNumber = d3Scale.scaleSqrt();
squarerootScaleString = d3Scale.scaleSqrt<string>();
squarerootScaleNumString = d3Scale.scaleSqrt<number, string>();
// ScalePower Interface ========================================================
// exponent --------------------------------------------------------------------
示例6: valueOf
// --------------------------------------------------------------------------
// Test Axis Generators
// --------------------------------------------------------------------------
let topAxis: d3Axis.Axis<number | { valueOf(): number }> = d3Axis.axisTop(scaleLinear());
let rightAxis: d3Axis.Axis<Date> = d3Axis.axisRight<Date>(scaleTime());
let bottomAxis: d3Axis.Axis<string> = d3Axis.axisBottom(scaleOrdinal<number>());
let leftAxis: d3Axis.Axis<number | { valueOf(): number }> = d3Axis.axisLeft(scaleLinear<number>());
// --------------------------------------------------------------------------
// Test Configure Axis
// --------------------------------------------------------------------------
// scale(...) ----------------------------------------------------------------
leftAxis = leftAxis.scale(scalePow());
const powerScale: ScalePower<number, number> = leftAxis.scale<ScalePower<number, number>>();
bottomAxis = bottomAxis.scale(scaleOrdinal<number>());
// $ExpectError
bottomAxis = bottomAxis.scale(scalePow()); // fails, domain of scale incompatible with domain of axis
const axisScale: d3Axis.AxisScale<string> = bottomAxis.scale();
const ordinalScale: ScaleOrdinal<string, number> = bottomAxis.scale<ScaleOrdinal<string, number>>();
// ticks(...) ----------------------------------------------------------------
topAxis = topAxis.ticks(20, ',f');
rightAxis = rightAxis.ticks(timeMinute.every(5));