[d3-scale-chromatic] Upgrade to v1.5.0 (#43917)

This commit is contained in:
Axel Bocciarelli 2020-04-16 01:27:15 +02:00 committed by GitHub
parent 537903f44e
commit 88c95a5c06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 9 deletions

View File

@ -12,7 +12,7 @@ import * as d3ScaleChromatic from 'd3-scale-chromatic';
// Preparatory Steps
// -----------------------------------------------------------------------
let colorInterpolator: ((t: number) => string);
let colorInterpolator: (t: number) => string;
let simpleScheme: ReadonlyArray<string>;
let nestedScheme: ReadonlyArray<ReadonlyArray<string>>;
@ -29,6 +29,7 @@ simpleScheme = d3ScaleChromatic.schemePastel2;
simpleScheme = d3ScaleChromatic.schemeSet1;
simpleScheme = d3ScaleChromatic.schemeSet2;
simpleScheme = d3ScaleChromatic.schemeSet3;
simpleScheme = d3ScaleChromatic.schemeTableau10;
const category10: string = d3ScaleChromatic.schemeCategory10[0]; // #1f77b4
const accent: string = d3ScaleChromatic.schemeAccent[0]; // #7fc97f
@ -39,6 +40,7 @@ const pastel2: string = d3ScaleChromatic.schemePastel2[0]; // #b3e2cd
const set1: string = d3ScaleChromatic.schemeSet1[0]; // #e41a1c
const set2: string = d3ScaleChromatic.schemeSet2[0]; // #66c2a5
const set3: string = d3ScaleChromatic.schemeSet3[0]; // #8dd3c7
const tableau10: string = d3ScaleChromatic.schemeTableau10[0]; // #4e79a7
// -----------------------------------------------------------------------
// Diverging
@ -120,24 +122,28 @@ const schemeReds: string = d3ScaleChromatic.schemeReds[3][0]; // #fee0d2
// Sequential(Multi-Hue)
// -----------------------------------------------------------------------
colorInterpolator = d3ScaleChromatic.interpolateTurbo;
colorInterpolator = d3ScaleChromatic.interpolateViridis;
colorInterpolator = d3ScaleChromatic.interpolateMagma;
colorInterpolator = d3ScaleChromatic.interpolateInferno;
colorInterpolator = d3ScaleChromatic.interpolateMagma;
colorInterpolator = d3ScaleChromatic.interpolatePlasma;
colorInterpolator = d3ScaleChromatic.interpolateRainbow;
colorInterpolator = d3ScaleChromatic.interpolateSinebow;
colorInterpolator = d3ScaleChromatic.interpolateCividis;
colorInterpolator = d3ScaleChromatic.interpolateWarm;
colorInterpolator = d3ScaleChromatic.interpolateCool;
colorInterpolator = d3ScaleChromatic.interpolateRainbow;
colorInterpolator = d3ScaleChromatic.interpolateSinebow;
colorInterpolator = d3ScaleChromatic.interpolateCubehelixDefault;
const Turbo: string = d3ScaleChromatic.interpolateTurbo(0.7);
const Viridis: string = d3ScaleChromatic.interpolateViridis(0.7);
const Magma: string = d3ScaleChromatic.interpolateMagma(0.7);
const Inferno: string = d3ScaleChromatic.interpolateInferno(0.7);
const Magma: string = d3ScaleChromatic.interpolateMagma(0.7);
const Plasma: string = d3ScaleChromatic.interpolatePlasma(0.7);
const Rainbow: string = d3ScaleChromatic.interpolateRainbow(0.7);
const Sinebow: string = d3ScaleChromatic.interpolateSinebow(0.7);
const Cividis: string = d3ScaleChromatic.interpolateCividis(0.7);
const Warm: string = d3ScaleChromatic.interpolateWarm(0.7);
const Cool: string = d3ScaleChromatic.interpolateCool(0.7);
const Rainbow: string = d3ScaleChromatic.interpolateRainbow(0.7);
const Sinebow: string = d3ScaleChromatic.interpolateSinebow(0.7);
const CubehelixDefault: string = d3ScaleChromatic.interpolateCubehelixDefault(0.7);
colorInterpolator = d3ScaleChromatic.interpolateBuGn;

View File

@ -1,4 +1,4 @@
// Type definitions for D3JS d3-scale-chromatic module 1.3
// Type definitions for D3JS d3-scale-chromatic module 1.5
// Project: https://github.com/d3/d3-scale-chromatic/, https://d3js.org/d3-scale-chromatic
// Definitions by: Hugues Stefanski <https://github.com/Ledragon>,
// Alex Ford <https://github.com/gustavderdrache>,
@ -6,7 +6,7 @@
// Henrique Machado <https://github.com/henriquefm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.3.2
// Last module patch version validated against: 1.5.0
// -----------------------------------------------------------------------
// Categorical
@ -47,6 +47,10 @@ export const schemeSet2: ReadonlyArray<string>;
* An array of twelve categorical colors represented as RGB hexadecimal strings.
*/
export const schemeSet3: ReadonlyArray<string>;
/**
* An array of ten categorical colors authored by Tableau as part of Tableau 10 represented as RGB hexadecimal strings.
*/
export const schemeTableau10: ReadonlyArray<string>;
// -----------------------------------------------------------------------
// Diverging
@ -268,6 +272,13 @@ export const schemeReds: ReadonlyArray<ReadonlyArray<string>>;
// Sequential(Multi-Hue)
// -----------------------------------------------------------------------
/**
* Given a number t in the range [0,1], returns the corresponding color from the turbo color scheme by Anton Mikhailov.
*
* @param t A number in the interval [0, 1].
*/
export function interpolateTurbo(t: number): string;
/**
* Given a number t in the range [0,1], returns the corresponding color from the viridis perceptually-uniform color scheme designed by van der Walt, Smith and Firing for matplotlib,
* represented as an RGB string.
@ -300,6 +311,14 @@ export function interpolateMagma(t: number): string;
*/
export function interpolatePlasma(t: number): string;
/**
* Given a number t in the range [0,1], returns the corresponding color from the plasma perceptually-uniform color scheme designed by van der Walt and Smith for matplotlib,
* represented as an RGB string.
*
* @param t A number in the interval [0, 1].
*/
export function interpolateCividis(t: number): string;
/**
* Given a number t in the range [0,1], returns the corresponding color from a 180° rotation of Niccolis perceptual rainbow, represented as an RGB string.
*