Skip to content
Snippets Groups Projects
Commit c71c1b0f authored by Alexander Rose's avatar Alexander Rose
Browse files

sanitize scale.color input to domain

parent b1296fb9
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ export namespace ColorScale {
const diff = (max - min) || 1
function color(value: number) {
const t = ((value - min) / diff) * count1
const t = Math.min(colors.length - 1, Math.max(0, ((value - min) / diff) * count1))
const tf = Math.floor(t)
const c1 = colors[tf]
const c2 = colors[Math.ceil(t)]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment