in charts/shared/colorscale.js [6:38]
constructor(options) {
const colorPreset = colorPresets["guardian"]
const isString = typeof options === "string"
const getProp = (p) => (!options || isString ? null : options[p])
const type = options ? (isString ? options : options.type) : "ordinal"
const domain = getProp("domain")
const colors = getProp("colors")
this.divisor = getProp("divisor")
switch (type) {
case "linear":
this.cScale = scaleLinear().range(colorPreset)
break
case "threshold":
this.cScale = scaleThreshold().range(colorPreset)
break
case "quantile":
this.cScale = scaleQuantile().range(colorPreset)
break
case "quantize":
this.cScale = scaleQuantize().range(colorPreset)
break
case "ordinal":
default:
this.cScale = scaleOrdinal().range(colorPreset)
}
this.set(domain, colors)
}