JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Buildup and Burndown Charts</title>
<!-- Include D3.js -->
<script src="https://d3js.org/d3.v6.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
}
.chart-container {
margin: 50px;
}
.axis-label {
font-size: 12px;
font-weight: bold;
}
.legend {
font-size: 12px;
}
.line {
fill: none;
stroke-width: 2px;
}
</style>
</head>
<body>
<div class="chart-container">
<h2>Buildup Chart</h2>
<svg id="buildupChart" width="900" height="500"></svg>
</div>
<div class="chart-container">
<h2>Burndown Chart</h2>
<svg id="burndownChart" width="900" height="500"></svg>
</div>
<script>
(function() {
// -------------------------------
// 2. Parse and Preprocess the Data
// -------------------------------
const parseDate = d3.timeParse("%Y-%m-%d");
const eventsData = [
{
"eventid": 1,
"riskid": null,
"eventtitle": "Component Sourcing",
"eventstatus": "Complete",
"eventownerid": 1,
"actualdate": "2024-09-01",
"actuallikelihood": 4,
"actualtechnical": 5,
"actualschedule": 3,
"actualcost": 4,
"baselinedate": "2024-09-01",
"baselinelikelihood": 4,
"baselinetechnical": 5,
"baselineschedule": 3,
"baselinecost": 4,
"scheduledate": null,
"scheduledlikelihood":...