当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript d3-scale.scalePow函数代码示例

本文整理汇总了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]]]);
}
开发者ID:FH-Potsdam,项目名称:shifted-maps,代码行数:7,代码来源:config.ts

示例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]]]);
}
开发者ID:FH-Potsdam,项目名称:shifted-maps,代码行数:8,代码来源:config.ts

示例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]]]);
}
开发者ID:FH-Potsdam,项目名称:shifted-maps,代码行数:8,代码来源:config.ts

示例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');
开发者ID:EmmaRamirez,项目名称:DefinitelyTyped,代码行数:31,代码来源:d3-axis-tests.ts

示例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 --------------------------------------------------------------------
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:29,代码来源:d3-scale-tests.ts

示例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));
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:30,代码来源:d3-axis-tests.ts


注:本文中的d3-scale.scalePow函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。