本文整理汇总了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) --------------------------------------------------------------------------------------------
示例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`
}
}