<!DOCTYPE html>
<
html
lang
=
"en"
>
<
head
>
<
meta
charset
=
"UTF-8"
/>
<
meta
name
=
"viewport"
path1tent = "
width
=
device
-width,
initial-scale
=
1
.0"/>
<
title
>GeekforGeeks</
title
>
<
script
src
=
</
script
>
</
head
>
<
body
>
<
script
>
// Creating the band scale
// with specified domain and range.
var band = d3.scaleBand()
.domain([10, 20, 30, 40, 50])
.range([1, 10]);
// Discrete values are automatically created
// By the band function
// Band of the range is [1, 10]
console.log(
"Before any type of change in original scale:");
console.log("band(10): ", band(10));
console.log("band(50): ", band(50));
// Making copy of the original scale
var bandCopy = band.copy();
console.log(
"When the range of the original "+
"scale is changed to rangeRound:");
// Making changes to the original scale
band.rangeRound([1, 10]);
console.log("band(10): ", band(10));
console.log("band(50): ", band(50));
console.log("Output of the copy scale:");
console.log("bandCopy(10): ", bandCopy(10));
console.log("bandCopy(50): ", bandCopy(50));
</
script
>
</
body
>
</
html
>