<!DOCTYPE html>
<
html
lang
=
"en"
>
<
head
>
<
meta
charset
=
"UTF-8"
/>
<
meta
name
=
"viewport"
path1tent="
width
=
device
-width,
initial-scale
=
1
.0" />
</
script
>
</
script
>
</
script
>
</
script
>
<
style
>
body {
margin-left: 40px;
}
h2 {
color: green;
}
div {
float: left;
width: 280px;
}
</
style
>
</
head
>
<
body
>
<
h2
>Geeks for geeks</
h2
>
<
p
>time.rangeRound() Function </
p
>
<
script
>
var time = d3.scaleTime()
// Setting domain for the scale.
.domain([1, 10])
// Setting the range of the scale.
.range([1, 100]);
document.write(
"<
div
><
h3
>Without time.rangeRound()</
h3
>");
document.write(
"<
h3
>time(1.5): " + time(1.5) + "</
h3
>");
document.write(
"<
h3
>time(2): " + time(2) + "</
h3
>");
document.write(
"<
h3
>time(3.5): " + time(3.5) + "</
h3
>");
document.write(
"<
h3
>time(4.5): " + time(4.5) + "</
h3
></
div
>");
var time = d3.scaleTime()
// Setting domain for the scale.
.domain([1, 10])
// Setting the range of the scale.
.rangeRound([1, 100]);
document.write(
"<
div
><
h3
>With time.rangeRound()</
h3
>");
document.write(
"<
div
><
h3
>time(1.5): " + time(1.5) + "</
h3
>");
document.write(
"<
h3
>time(2): " + time(2) + "</
h3
>");
document.write(
"<
h3
>time(3.5): " + time(3.5) + "</
h3
>");
document.write(
"<
h3
>time(4.5): " + time(4.5) + "</
h3
></
div
>");
</
script
>
</
body
>
</
html
>