當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。