當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript d3-interpolate.interpolateRgbBasis函數代碼示例

本文整理匯總了TypeScript中d3-interpolate.interpolateRgbBasis函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript interpolateRgbBasis函數的具體用法?TypeScript interpolateRgbBasis怎麽用?TypeScript interpolateRgbBasis使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了interpolateRgbBasis函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: iString

// arrStr = d3Interpolate.quantize<string>(d3Interpolate.interpolateRound(-1, 2), 4); // test fails, due to explicit typing v argument type mismatch

// test interpolateRgb(a, b) signatures ----------------------------------------------------------------

// without gamma correction
iString = d3Interpolate.interpolateRgb('seagreen', 'steelblue');
iString = d3Interpolate.interpolateRgb(d3Color.rgb('seagreen'), d3Color.hcl('steelblue'));
iString = d3Interpolate.interpolateRgb(d3Color.rgb('seagreen'), d3Hsv.hsv('steelblue'));
str = iString(0.5);

// with gamma correction
iString = d3Interpolate.interpolateRgb.gamma(2.2)('purple', 'orange');

// test interpolateRgbBasis(color) and  interpolateRgbBasisClosed(color) signatures -------------------------

iString = d3Interpolate.interpolateRgbBasis(['seagreen', d3Color.rgb('steelblue'), 'rgb(100, 100, 100)']);
iString = d3Interpolate.interpolateRgbBasis(['seagreen', d3Hsv.hsv('steelblue'), 'rgb(100, 100, 100)']);
iString = d3Interpolate.interpolateRgbBasisClosed(['seagreen', d3Hsv.hsv('steelblue'), 'rgb(100, 100, 100)']);

// test interpolateHsl(a, b) and interpolateHslLong(a, b)----------------------------------------------------------------

iString = d3Interpolate.interpolateHsl('seagreen', 'steelblue');
iString = d3Interpolate.interpolateHsl(d3Color.rgb('seagreen'), d3Color.hcl('steelblue'));
iString = d3Interpolate.interpolateHsl(d3Color.rgb('seagreen'), d3Hsv.hsv('steelblue'));

iString = d3Interpolate.interpolateHslLong('seagreen', 'steelblue');
iString = d3Interpolate.interpolateHslLong(d3Color.rgb('seagreen'), d3Color.hcl('steelblue'));
iString = d3Interpolate.interpolateHslLong(d3Color.rgb('seagreen'), d3Hsv.hsv('steelblue'));

// test interpolateLab(a, b) --------------------------------------------------------------------------------------------
開發者ID:ArtemZag,項目名稱:DefinitelyTyped,代碼行數:30,代碼來源:d3-interpolate-tests.ts

示例2: rgb

import flatten from "ramda/es/flatten";
import * as template from "./heatmap.pug";

const colorSuggestions = [
    rgb("#2c7bb6"),
    rgb("#00a6ca"),
    rgb("#00ccbc"),
    rgb("#90eb9d"),
    rgb("#ffff8c"),
    rgb("#f9d057"),
    rgb("#f29e2e"),
    rgb("#e76818"),
    rgb("#d7191c")
];

const colorInterpolator = interpolateRgbBasis(colorSuggestions);

class HeatmapController implements IController {

    public data: any;
    public heatmapStyle: any;
    public Styles: any;

    $onInit() {
        const rowSize = this.data.length * 90;
        this.Styles = Styles;
        this.heatmapStyle = {
            width: `${rowSize}px`,
            height: `${rowSize}px`
        }
    }
開發者ID:robertfmurdock,項目名稱:Coupling,代碼行數:31,代碼來源:heatmap.ts


注:本文中的d3-interpolate.interpolateRgbBasis函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。