Published
Edited
Nov 9, 2021
Importers
Insert cell
# Number Chart
Insert cell
renderNumber(3141596668.2653589793238462643);
Insert cell
function renderNumber(number) {
let splitted = number.toString().split(".");
let result = "";
if (splitted.length === 2) {
let wholeNum = splitted[0].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
result = wholeNum + "." + splitted[1].toString();
}
else {
result = splitted[0]
}
let innerHtml = html `
<div
style="
font-size: 2.5em;
font-weight: bold;
padding-top: 20px;
padding-bottom: 20px;
text-align: center;" >
${result}
</div>
`;
return innerHtml;
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more