<div id="observablehq-chart-b24de8d3"></div>
<div id="observablehq-viewof-replay-b24de8d3"></div>
<script type="module">
import {Runtime, Inspector} from "https://cdn.jsdelivr.net/npm/@observablehq/runtime@4/dist/runtime.js";
import define from "https://api.observablehq.com/@aagostini/bar-chart-race-explained.js?v=3";
const main = new Runtime().module(define, name => {
if (name === "viewof replay") return new Inspector(document.querySelector("#observablehq-viewof-replay-b24de8d3"));
if (name === "chart") return new Inspector(document.querySelector("#observablehq-chart-b24de8d3"));
});
const newData = [
{
"date": "1990-01-01T00:00:00.000Z",
"name": "OLIVIA",
"value": 1600,
"category": "OLIVIA"
},
{
"date": "1990-01-01T00:00:00.000Z",
"name": "ELIZABETH",
"value": 1500,
"category": "ELIZABETH"
},
{
"date": "1990-01-01T00:00:00.000Z",
"name": "JUSTIN",
"value": 1500,
"category": "JUSTIN"
},
{
"date": "1990-01-01T00:00:00.000Z",
"name": "CHARLIE",
"value": 1500,
"category": "CHARLIE"
},
{
"date": "1991-01-01T00:00:00.000Z",
"name": "OLIVIA",
"value": 1200,
"category": "OLIVIA"
},
{
"date": "1991-01-01T00:00:00.000Z",
"name": "ELIZABETH",
"value": 1400,
"category": "ELIZABETH"
},
{
"date": "1991-01-01T00:00:00.000Z",
"name": "JUSTIN",
"value": 1300,
"category": "JUSTIN"
},
{
"date": "1991-01-01T00:00:00.000Z",
"name": "CHARLIE",
"value": 1340,
"category": "CHARLIE"
},
{
"date": "1992-01-01T00:00:00.000Z",
"name": "OLIVIA",
"value": 1000,
"category": "OLIVIA"
},
{
"date": "1992-01-01T00:00:00.000Z",
"name": "ELIZABETH",
"value": 1400,
"category": "ELIZABETH"
},
{
"date": "1992-01-01T00:00:00.000Z",
"name": "JUSTIN",
"value": 1120,
"category": "JUSTIN"
},
{
"date": "1992-01-01T00:00:00.000Z",
"name": "CHARLIE",
"value": 1340,
"category": "CHARLIE"
}
]
// main.redefine("data", newData);
main.redefine("data", newData.map(d=> Object.assign(d, {date: new Date(d.date)})));
</script>
#observablehq-viewof-replay-b24de8d3 > button {
height: 40px;
width: 175px;
/* padding: 0px; */
margin: 20px 0px;
cursor: pointer;
background: none rgb(255, 255, 255);
border: 1px solid rgb(52, 127, 107);
text-align: center;
display: block;
position: absolute;
box-sizing: border-box;
z-index: 2;
height: 40px;
font-family: Roboto;
font-size: 18px;
font-weight: 500;
color: rgb(0, 129, 109);
letter-spacing: 1px;
line-height: 1;
border-radius: 4px;
left: calc(50% - 87.5px);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.