<!DOCTYPE html>
<
html
lang
=
"en"
>
<
head
>
<
meta
charset
=
"UTF-8"
/>
<
meta
name
=
"viewport"
path1tent
=
"width=device-width,initial-scale=1.0"
/>
</
script
>
</
head
>
<
body
>
<
h2
style
=
"color:green;"
>GeeksforGeeks</
h2
>
<
p
>threshold.range() Function </
p
>
<
script
>
var threshold = d3.scaleThreshold()
// Setting domain for the scale.
.domain([10, 20, 30, 40])
// Setting the range for the scale.
// Number of elements is one more
// then domain array size.
.range([0.01, 0.02, 0.03, 0.04, 0.05]);
document.write("<
h4
>"
+ threshold(20) + "</
h4
>"); // 0.03
document.write("<
h4
>"
+ threshold(40) + "</
h4
>"); // 0.05
// This value is outside the domain
document.write("<
h4
>"
+ threshold(500) + "</
h4
>"); // 0.05
</
script
>
</
body
>
</
html
>