Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* Typescript definition tests for d3/d3-scale-chromatic module
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
*/
import * as d3ScaleChromatic from 'd3-scale-chromatic';
// -----------------------------------------------------------------------
// Categorical
// -----------------------------------------------------------------------
let accent: string = d3ScaleChromatic.schemeAccent[0]; // #7fc97f
let dark: string = d3ScaleChromatic.schemeDark2[0]; // #1b9e77
let paired: string = d3ScaleChromatic.schemePaired[0]; // #a6cee3
let pastel1: string = d3ScaleChromatic.schemePastel1[0]; // #fbb4ae
let pastel2: string = d3ScaleChromatic.schemePastel2[0]; // #b3e2cd
let set1: string = d3ScaleChromatic.schemeSet1[0]; // #e41a1c
let set2: string = d3ScaleChromatic.schemeSet2[0]; // #66c2a5
let set3: string = d3ScaleChromatic.schemeSet3[0]; // #8dd3c7
// -----------------------------------------------------------------------
// Diverging
// -----------------------------------------------------------------------
let BrBG: string = d3ScaleChromatic.interpolateBrBG(0); // rgb(84, 48, 5)
let PRGn: string = d3ScaleChromatic.interpolatePRGn(0); // rgb(64, 0, 75)
let PiYG: string = d3ScaleChromatic.interpolatePiYG(0); // rgb(142, 1, 82)
let PuOr: string = d3ScaleChromatic.interpolatePuOr(0); // rgb(127, 59, 8)
let RdBu: string = d3ScaleChromatic.interpolateRdBu(0); // rgb(103, 0, 31)
let RdGy: string = d3ScaleChromatic.interpolateRdGy(0); // rgb(103, 0, 31)
let RdYlBu: string = d3ScaleChromatic.interpolateRdYlBu(0); // rgb(103, 0, 31)
let RdYlGn: string = d3ScaleChromatic.interpolateRdYlGn(0); // rgb(103, 0, 31)
} from './symbolSchemes';
import * as _ from 'd3-scale-chromatic';
import {interpolateRgbBasis} from 'd3-interpolate';
import {peek} from 'vega-util';
var discretized = {
blueorange: blueOrange
};
var schemes = {
// d3 categorical palettes
category10: _.schemeCategory10,
accent: _.schemeAccent,
dark2: _.schemeDark2,
paired: _.schemePaired,
pastel1: _.schemePastel1,
pastel2: _.schemePastel2,
set1: _.schemeSet1,
set2: _.schemeSet2,
set3: _.schemeSet3,
// additional categorical palettes
category20: category20,
category20b: category20b,
category20c: category20c,
tableau10: tableau10,
tableau20: tableau20,
// sequential multi-hue interpolators
viridis: _.interpolateViridis,
magma: _.interpolateMagma,
inferno: _.interpolateInferno,
.attr("fill", (d) => {
let color = "rgb(0,0,0)";
if (d.Species === "Con") {
color = chromatic.schemePastel1[0]
} else if (d.Species === "Hei") {
color = chromatic.schemePastel1[1]
} else if (d.Species === "Hep") {
color = chromatic.schemePastel1[2]
}
return color;
})
.attr("cx", (d) => { return x(d.Width); })