API security has never been more important because modern APIs are operational necessities.
Unfortunately, many organizations are failing to adapt their security models to a rapidly changing API threat landscape. Like it or not, we live in an AI-first world, and API security must reflect that reality. The Postman 2025 State of API Report is confirmation of that fact.
AI already plays a significant role in modern business functions. A staggering 89% of developers use generative AI in their daily work, helping with everything from improving code quality (68%), to generating API documentation (41%), and even generating API design (28%).
In short, modern developers are AI native. They rely on AI and, as technology evolves, will likely become even more reliant in the years to come.
AI agents are a key part of this transition. They go beyond mere AI code assistants, acting as autonomous autopilots for software development and testing tasks. Ultimately, their ability to act without human input will irreversibly redefine the developer experience, largely for the better.
However, increased use of AI agents is also redefining threat surfaces. In fact, they have become the new threat surface. And organizations must adapt to that new reality.
The increasing reliance on AI, particularly agentic AI, essentially means that AI agents are the new API consumers.
This matters because they can call endpoints thousands of times per second, process data at unprecedented scale, and integrate systems in ways that traditional API design never anticipated. The new security risks these creates are reflected in developer concerns:
The question, then, is what organizations must do to defend against AI consumers. Postman offers five recommended changes:
Sound familiar? That’s because Postman’s recommendations for AI security are already part of API security. Wallarm’s platform, for example, provides real-time, behavior-based API protection that automatically identifies and mitigates AI agent traffic by:
However, one problem remains: APIs aren’t built for AI. And developers aren’t doing enough to change that.
Although developers are using AI, they’re not designing APIs to handle AI workloads. According to the Postman report, 89% of developers use AI, but only 24% design APIs for AI agents. They’re still assuming traditional consumption. In fact:
Frankly, this doesn’t reflect the reality of API consumption. 68% of respondents said they relied on AI to improve code quality. But traditional APIs break when AI tries to use them, and that’s when security cracks open.
Put simply, AI-driven consumers magnify every flaw in your API design and documentation. If your schema isn’t explicit and machine-readable, you’re already behind.
Our platform exposes inconsistencies and undocumented endpoints that AI agents could exploit, turning vague, human-centric APIs into well-defined, governed, and monitored interfaces.
Amidst a changing API threat landscape, your organization needs a platform that can adapt.
/* ====== CONFIG ====== */
const MOUNT_ID = "cloud-outages-viz";
/* ====== DATA ====== */
const outages = [
{date:"2/28/2017", year:2017, provider:"AWS", service:"AWS – S3 (US-EAST-1)", cause:"Maintenance engineer mis-typed command; S3 index/placement subsystems deleted.", impact:"~4h S3 unavailability in US-EAST-1; ripple effects widely."},
{date:"6/2/2019", year:2019, provider:"Google", service:"GCP – network control plane", cause:"Misconfig + bug in maintenance automation; BGP withdrawn; severe packet loss.", impact:"~3–4h congestion/packet loss (11:45–~16:10 PT)."},
{date:"6/21/2019", year:2019, provider:"Cloudflare", service:"Cloudflare – CDN / internet routing", cause:"Verizon BGP misconfig routed huge traffic via small ISP; routes corrected later.", impact:"~3h global disruption for Cloudflare-protected sites."},
{date:"10/22/2019", year:2019, provider:"Google", service:"GCP – leader election / networking", cause:"Chubby leadership flaps + race; invalid network programming; 100% packet loss.", impact:"~2.5h; us-west-1b + others lost connectivity (16:30–18:51 PT)."},
{date:"1/25/2020", year:2020, provider:"Microsoft", service:"Azure – SQL / backend dependency", cause:"Backend dependency failure in Azure SQL; broad warnings across services.", impact:"~6h from 05:53."},
{date:"7/17/2020", year:2020, provider:"Cloudflare", service:"Cloudflare – backbone network", cause:"Config change diverted all backbone traffic to ATL; router overwhelmed.", impact:"~27m (21:12–21:39 UTC); normalized by 22:10 UTC."},
{date:"8/30/2020", year:2020, provider:"Cloudflare", service:"Cloudflare – transit connectivity", cause:"CenturyLink/Level 3 outage; failing paths increased 5xx; manual reroute.", impact:"Several hours degraded performance; external network failure."},
{date:"11/25/2020", year:2020, provider:"AWS", service:"AWS – Kinesis & dependent", cause:"Added capacity increased inter-host threads; hit OS thread limit; FE failed.", impact:"~17h; Kinesis + CloudWatch/Lambda/Cognito/Firehose etc."},
{date:"12/14/2020", year:2020, provider:"Google", service:"Google – OAuth/auth", cause:"Quota migration mis-reported zero; automated enforcement blocked writes.", impact:"~47m global auth failures + elevated API errors."},
{date:"2/12/2021", year:2021, provider:"Microsoft", service:"Azure – Cosmos DB & related", cause:"Cosmos DB connectivity failures in East/West US; cascaded to others.", impact:"~1h15m (00:30–01:43 UTC)."},
{date:"3/11/2021", year:2021, provider:"Oracle", service:"OCI – global network & console", cause:"Issues with dynamic DNS provider across many regions.", impact:"~2h outage."},
{date:"4/1/2021", year:2021, provider:"Microsoft", service:"Azure – DNS infrastructure", cause:"Surge exposed code defect; cache efficiency dropped; retries overwhelmed.", impact:"Recovered by 22:00–22:30 UTC (~2.5h)."},
{date:"6/8/2021", year:2021, provider:"Fastly", service:"Fastly – CDN", cause:"Customer config change hit undiscovered bug; 85% network errors.", impact:"95% recovered in 49m."},
{date:"7/22/2021", year:2021, provider:"Akamai", service:"Akamai – Edge DNS", cause:"Software update bug; DNS outage; rollback restored.", impact:"~1h DNS failures."},
{date:"11/16/2021", year:2021, provider:"Google", service:"GCP – network configuration", cause:"Latent bug triggered during leader election; LB misconfig; widespread 404.", impact:"~1h50m (12:39–~14:28 ET)."},
{date:"12/7/2021", year:2021, provider:"AWS", service:"AWS – US-EAST-1 network devices", cause:"Impairment of several network devices disrupted APIs and services.", impact:"Several hours until capacity restored."},
{date:"12/15/2021", year:2021, provider:"AWS", service:"AWS – US-West-1/2 congestion", cause:"Traffic-engineering change caused backbone/ISP congestion.", impact:"~1h degraded services (US-West-1/2)."},
{date:"12/22/2021", year:2021, provider:"AWS", service:"AWS – US-EAST-1 AZ power", cause:"Power failure in AZ-4 at 04:35 PST; instance/volume issues lingered.", impact:"~1h power loss + recovery tail."},
{date:"6/21/2022", year:2022, provider:"Cloudflare", service:"Cloudflare – CDN / data plane", cause:"New architecture rollout withdrew critical BGP prefixes; 19 DCs offline.", impact:"~1h15m (06:27–07:42 UTC)."},
{date:"6/29/2022", year:2022, provider:"Microsoft", service:"Azure – Firewall & Data Explorer", cause:"Multi-region connectivity issues; no disclosed root cause.", impact:"~24h degradation."},
{date:"7/19/2022", year:2022, provider:"Oracle", service:"Oracle & Google – UK cooling", cause:"Heatwave cooling failures; powered down to protect equipment.", impact:"Several hours unavailable until cooling/power restored."},
{date:"8/9/2022", year:2022, provider:"Google", service:"Google – Search/Maps/YouTube", cause:"Software update issue; 500/502 globally.", impact:"~30m until rollback."},
{date:"1/18/2023", year:2023, provider:"Microsoft", service:"Azure – West Europe storage", cause:"Power event in data hall; storage impacted; cascade.", impact:"Several hours; restored by 13:23 UTC."},
{date:"1/24/2023", year:2023, provider:"Cloudflare", service:"Cloudflare – Control plane / ZT", cause:"Release overwrote token metadata; tokens invalidated.", impact:"~121m services degraded/unavailable."},
{date:"1/25/2023", year:2023, provider:"Microsoft", service:"Azure – Outlook/Teams/Portal", cause:"WAN connectivity issue; rollback restored.", impact:"Several hours; multi-continent."},
{date:"2/13/2023", year:2023, provider:"Oracle", service:"OCI – Public DNS API", cause:"Back-end perf issue blocked DNS API.", impact:"~55h (Feb 13 17:30–Feb 15 22:30 GMT)."},
{date:"10/4/2023", year:2023, provider:"Cloudflare", service:"Cloudflare – 1.1.1.1", cause:"Root zone ZONEMD change; DNSSEC signatures expired.", impact:"~3h SERVFAIL spikes."},
{date:"11/2/2023", year:2023, provider:"Cloudflare", service:"Cloudflare – Control plane/analytics", cause:"Flexential PDX power feed lost; dependencies remained.", impact:"~40h (Nov 2 11:44–Nov 4 04:25 UTC)."},
{date:"1/16/2024", year:2024, provider:"Oracle", service:"OCI – network disruption", cause:"Network disruption across regions; coincided with security patch.", impact:"~40m; brief recurrence."},
{date:"3/14/2024", year:2024, provider:"Microsoft", service:"Azure – South Africa N/W", cause:"Multiple subsea cuts + router optic failure; capacity reduced.", impact:"Mar 14 10:33–Mar 15 11:00 UTC."},
{date:"3/26/2024", year:2024, provider:"Cloudflare", service:"Cloudflare – Control plane (PDX01)", cause:"Portland facility power loss; auto failover.", impact:"~7m API/dashboard; analytics degraded part of day."},
{date:"7/30/2024", year:2024, provider:"Microsoft", service:"Azure – M365/Azure", cause:"DDoS + faulty response amplified impact.", impact:"~8h."},
{date:"10/24/2024", year:2024, provider:"Google", service:"GCP – europe-west3", cause:"Power failure + electrical arc; cooling degraded; partial shutdown.", impact:"~7.5h (02:22–10:01 UTC)."},
{date:"11/13/2024", year:2024, provider:"Microsoft", service:"Azure – DNS/Databricks", cause:"DNS issues across regions; mitigated within hours.", impact:"~8.5h (01:13–~09:53 UTC)."},
{date:"12/26/2024", year:2024, provider:"Microsoft", service:"Azure – South Central US", cause:"Data hall failed to switch to alternate power; compute/net/storage loss.", impact:"Dec 26 18:40 UTC → Dec 27 varying times."},
{date:"1/8/2025", year:2025, provider:"Microsoft", service:"Azure – East US2", cause:"Network config issue; 3 storage partitions unhealthy; VM impact.", impact:"Jan 8 → Jan 10 16:39 UTC (~2 days)."},
{date:"3/21/2025", year:2025, provider:"Cloudflare", service:"Cloudflare – R2 & Workers", cause:"Prod creds deleted due to CLI run without --env production; writes failed.", impact:"~1h07m global R2/Workers outage."},
{date:"5/20/2025", year:2025, provider:"IBM", service:"IBM Cloud – control plane (IAM/login)", cause:"Cloud Logs update created traffic surge; IAM overwhelmed.", impact:"~2h10m; 14 services."},
{date:"5/20/2025", year:2025, provider:"Oracle", service:"OCI – identity (Frankfurt)", cause:"Identity outage in Germany Central; failover to NL failed.", impact:"~6h; EU customers couldn’t authenticate."},
{date:"6/2/2025", year:2025, provider:"IBM", service:"IBM Cloud – control plane collapse", cause:"Delayed logins triggered retries; global control overwhelmed; IAM/DNS cascade.", impact:"~14h (09:05–23:10 UTC); 41 services."},
{date:"6/5/2025", year:2025, provider:"IBM", service:"IBM Cloud – multi-service outage", cause:"Another IAM failure; at least 54 services impacted.", impact:">4h; console/API access blocked."},
{date:"6/12/2025", year:2025, provider:"Cloudflare", service:"Cloudflare – Workers KV/Zero Trust", cause:"Third-party storage provider failure; over-dependence acknowledged.", impact:"~2h28m; KV, WARP, Access, Gateway, Images degraded."},
{date:"6/12/2025", year:2025, provider:"Google", service:"GCP – Service Control & APIs", cause:"New quota-policy feature introduced null-pointer; corrupted policy propagated.", impact:"Started 10:51 AM PDT; most regions ~40m, us-central-1 ~2h40m."},
{date:"7/14/2025", year:2025, provider:"Cloudflare", service:"Cloudflare – 1.1.1.1 resolver", cause:"Dormant config error from Jun 6 triggered on deploy.", impact:"~62m global resolver failure."},
{date:"8/11/2025", year:2025, provider:"IBM", service:"IBM Cloud – authentication failures", cause:"IAM failures locked users out; 27 services across 10 regions.", impact:"~2h23m (12:59–14:09 UTC)."},
{date:"8/21/2025", year:2025, provider:"Cloudflare", service:"Cloudflare – Peering links w/ AWS", cause:"Traffic surge from single AWS us-east-1 customer saturated peering links.", impact:"~3h50m (16:27–20:18 UTC)."},
{date:"9/12/2025", year:2025, provider:"Cloudflare", service:"Cloudflare – Dashboard & APIs", cause:"Dashboard bug spammed Tenant Service API; overwhelmed.", impact:"~1h until revert."},
{date:"10/9/2025", year:2025, provider:"Microsoft", service:"Azure – Front Door/portals", cause:"Capacity loss across AFD in EU/AF; routing issues.", impact:"~5h (≈07:40 UTC–≈12:07 EDT)."},
{date:"10/20/2025", year:2025, provider:"AWS", service:"AWS – US-EAST-1 control plane", cause:"DynamoDB endpoint DNS resolution issues from internal health monitor.", impact:"Several hours; global impacts (Slack, Snapchat, Atlassian, etc.)."}
];
/* ====== UTIL ====== */
const parseUSDate = s => {
const [m,d,y] = s.split("/").map(v=>parseInt(v,10));
return new Date(y, m-1, d);
};
const groupBy = (arr, keyFn) => arr.reduce((m,o)=>((m[keyFn(o)]??=[]).push(o),m),{});
const uniq = arr => Array.from(new Set(arr));
/* ====== RENDER ====== */
(function render(){
const root = document.getElementById(MOUNT_ID);
root.innerHTML = "";
root.style.fontFamily = "Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif";
root.style.lineHeight = "1.35";
root.style.color = "#111";
root.style.maxWidth = "1100px";
root.style.margin = "24px auto";
root.style.padding = "8px 12px";
const title = document.createElement("h2");
title.textContent = "Major Cloud/Network Outages (2017–2025)";
title.style.margin = "0 0 8px 0";
title.style.fontSize = "22px";
root.appendChild(title);
const sub = document.createElement("div");
sub.textContent = "Filter by provider, hover for details. Data is embedded in this script.";
sub.style.color = "#555";
sub.style.marginBottom = "16px";
root.appendChild(sub);
// Controls
const controls = document.createElement("div");
controls.style.display = "flex";
controls.style.flexWrap = "wrap";
controls.style.gap = "8px 16px";
controls.style.alignItems = "center";
controls.style.marginBottom = "8px";
root.appendChild(controls);
const providers = uniq(outages.map(o=>o.provider)).sort();
const active = new Set(providers); // all on by default
const badge = (txt)=>{ const b=document.createElement("span");
b.textContent=txt;b.style.background="#f1f5f9";b.style.border="1px solid #e2e8f0";
b.style.borderRadius="999px";b.style.padding="4px 10px";b.style.fontSize="12px"; return b; };
const legendRow = document.createElement("div");
legendRow.style.display="flex";legendRow.style.gap="12px";legendRow.style.alignItems="center";
const legendLabel = badge("Providers:");
legendRow.appendChild(legendLabel);
const colorFor = (p)=>{
// fixed palette (color-blind friendly-ish)
const map = {
"AWS": "#2563eb",
"Google": "#16a34a",
"Microsoft": "#7c3aed",
"Cloudflare": "#ea580c",
"Oracle": "#dc2626",
"Fastly": "#0891b2",
"Akamai": "#9333ea",
"IBM": "#0ea5e9"
};
return map[p] || "#64748b";
};
providers.forEach(p=>{
const lab = document.createElement("label");
lab.style.display = "inline-flex";
lab.style.alignItems = "center";
lab.style.gap = "6px";
lab.style.cursor = "pointer";
const cb = document.createElement("input");
cb.type = "checkbox"; cb.checked = true;
cb.addEventListener("change", ()=>{ cb.checked?active.add(p):active.delete(p); update(); });
const swatch = document.createElement("span");
swatch.style.width="10px"; swatch.style.height="10px"; swatch.style.borderRadius="2px";
swatch.style.display="inline-block"; swatch.style.background=colorFor(p);
const txt = document.createElement("span");
txt.textContent = p; txt.style.fontSize="12px";
lab.appendChild(cb); lab.appendChild(swatch); lab.appendChild(txt);
legendRow.appendChild(lab);
});
controls.appendChild(legendRow);
// Containers
const grid = document.createElement("div");
grid.style.display = "grid";
grid.style.gridTemplateColumns = "1.1fr 0.9fr";
grid.style.gap = "16px";
grid.style.marginTop = "8px";
root.appendChild(grid);
const card = ()=>{ const c=document.createElement("div");
c.style.border="1px solid #e5e7eb"; c.style.borderRadius="12px"; c.style.padding="12px";
c.style.boxShadow="0 1px 2px rgba(0,0,0,0.04)"; c.style.background="#fff"; return c; };
const timelineCard = card(); grid.appendChild(timelineCard);
const barchartCard = card(); grid.appendChild(barchartCard);
const tableCard = card(); tableCard.style.marginTop="16px"; root.appendChild(tableCard);
// Timeline (SVG scatter along X=time)
const makeTimeline = (rows)=>{
timelineCard.innerHTML="";
const h3 = document.createElement("h3"); h3.textContent="Timeline"; h3.style.margin="0 0 8px 0"; h3.style.fontSize="16px";
timelineCard.appendChild(h3);
const W = timelineCard.clientWidth - 24, H = 260, PADL=48, PADR=16, PADT=20, PADB=36;
const svg = document.createElementNS("http://www.w3.org/2000/svg","svg");
svg.setAttribute("width","100%"); svg.setAttribute("height", H);
svg.setAttribute("viewBox", `0 0 ${W} ${H}`);
svg.style.display="block"; svg.style.userSelect="none"; svg.style.touchAction="none";
timelineCard.appendChild(svg);
if(rows.length===0){ const empty=document.createElement("div"); empty.textContent="No incidents for selected providers."; empty.style.color="#6b7280"; empty.style.padding="8px 0"; timelineCard.appendChild(empty); return; }
const xs = rows.map(r=>parseUSDate(r.date).getTime());
const xMin = Math.min(...xs), xMax = Math.max(...xs);
const xScale = t => {
if(xMax===xMin) return PADL + (W-PADL-PADR)/2;
return PADL + ( (t - xMin) / (xMax - xMin) ) * (W-PADL-PADR);
}
// axis
const axis = document.createElementNS(svg.namespaceURI,"g");
axis.setAttribute("transform",`translate(0, ${H-PADB})`);
svg.appendChild(axis);
// ticks: Jan 1 for each year in range
const years = uniq(rows.map(r=>r.year)).sort((a,b)=>a-b);
years.forEach(y=>{
const t = new Date(y,0,1).getTime();
const x = xScale(t);
const line = document.createElementNS(svg.namespaceURI,"line");
line.setAttribute("x1",x); line.setAttribute("x2",x); line.setAttribute("y1",0); line.setAttribute("y2",8);
line.setAttribute("stroke","#94a3b8"); axis.appendChild(line);
const txt = document.createElementNS(svg.namespaceURI,"text");
txt.setAttribute("x",x); txt.setAttribute("y",22); txt.setAttribute("text-anchor","middle");
txt.setAttribute("font-size","11"); txt.setAttribute("fill","#475569"); txt.textContent = y;
axis.appendChild(txt);
});
// guideline
const base = document.createElementNS(svg.namespaceURI,"line");
base.setAttribute("x1",PADL); base.setAttribute("x2",W-PADR); base.setAttribute("y1",H-PADB); base.setAttribute("y2",H-PADB);
base.setAttribute("stroke","#cbd5e1"); svg.appendChild(base);
// rows by provider to stack vertically
const provs = uniq(rows.map(r=>r.provider)).sort();
const yForProv = (p)=> {
const i = provs.indexOf(p);
const slotH = (H-PADT-PADB) / Math.max(1,provs.length);
return PADT + slotH*(i+0.5);
};
// labels (providers)
provs.forEach(p=>{
const y = yForProv(p);
const t = document.createElementNS(svg.namespaceURI,"text");
t.setAttribute("x",8); t.setAttribute("y",y+4); t.setAttribute("font-size","11");
t.setAttribute("fill","#64748b"); t.textContent = p;
svg.appendChild(t);
const guide = document.createElementNS(svg.namespaceURI,"line");
guide.setAttribute("x1",PADL); guide.setAttribute("x2",W-PADR); guide.setAttribute("y1",y); guide.setAttribute("y2",y);
guide.setAttribute("stroke","#f1f5f9"); svg.appendChild(guide);
});
// tooltip
const tip = document.createElement("div");
tip.style.position="absolute"; tip.style.pointerEvents="none"; tip.style.background="#111827"; tip.style.color="#fff";
tip.style.padding="8px 10px"; tip.style.borderRadius="8px"; tip.style.fontSize="12px"; tip.style.boxShadow="0 6px 20px rgba(0,0,0,0.2)";
tip.style.display="none"; tip.style.maxWidth="320px"; tip.style.zIndex="999";
timelineCard.style.position="relative"; timelineCard.appendChild(tip);
const showTip = (evt, r)=>{
const rect = timelineCard.getBoundingClientRect();
tip.innerHTML = `
${r.provider} — ${r.service}
${r.date} • ${r.year}
Root cause: ${r.cause}
Impact: ${r.impact}
`;
tip.style.left = (evt.clientX - rect.left + 12) + "px";
tip.style.top = (evt.clientY - rect.top - 10) + "px";
tip.style.display="block";
};
const hideTip = ()=> tip.style.display="none";
// points
rows.forEach(r=>{
const x = xScale(parseUSDate(r.date).getTime());
const y = yForProv(r.provider);
const g = document.createElementNS(svg.namespaceURI,"g");
const dot = document.createElementNS(svg.namespaceURI,"circle");
dot.setAttribute("cx",x); dot.setAttribute("cy",y); dot.setAttribute("r",6);
dot.setAttribute("fill", colorFor(r.provider)); dot.setAttribute("opacity","0.9");
const stroke = document.createElementNS(svg.namespaceURI,"circle");
stroke.setAttribute("cx",x); stroke.setAttribute("cy",y); stroke.setAttribute("r",9);
stroke.setAttribute("fill","none"); stroke.setAttribute("stroke", colorFor(r.provider)); stroke.setAttribute("opacity","0.25");
g.appendChild(stroke); g.appendChild(dot);
g.style.cursor="pointer";
g.addEventListener("mousemove",(e)=>showTip(e,r));
g.addEventListener("mouseleave", hideTip);
svg.appendChild(g);
});
};
// Bar chart: incidents by year
const makeBar = (rows)=>{
barchartCard.innerHTML="";
const h3 = document.createElement("h3"); h3.textContent="Incidents by Year"; h3.style.margin="0 0 8px 0"; h3.style.fontSize="16px";
barchartCard.appendChild(h3);
const W = barchartCard.clientWidth - 24, H = 260, PADL=36, PADR=12, PADT=12, PADB=32;
const svg = document.createElementNS("http://www.w3.org/2000/svg","svg");
svg.setAttribute("width","100%"); svg.setAttribute("height", H);
svg.setAttribute("viewBox", `0 0 ${W} ${H}`);
svg.style.display="block";
barchartCard.appendChild(svg);
if(rows.length===0){ const empty=document.createElement("div"); empty.textContent="No data."; empty.style.color="#6b7280"; empty.style.padding="8px 0"; barchartCard.appendChild(empty); return; }
const byYear = groupBy(rows, r=>r.year);
const years = Object.keys(byYear).map(Number).sort((a,b)=>a-b);
const counts = years.map(y=>byYear[y].length);
const xScale = i => PADL + i * ( (W-PADL-PADR) / years.length ) + 6;
const bw = Math.max(8, (W-PADL-PADR) / years.length - 12);
const maxC = Math.max(...counts);
const yScale = v => H-PADB - ( (v/maxC) * (H-PADT-PADB) );
// axis
const axisY = document.createElementNS(svg.namespaceURI,"line");
axisY.setAttribute("x1",PADL); axisY.setAttribute("x2",PADL); axisY.setAttribute("y1",PADT); axisY.setAttribute("y2",H-PADB);
axisY.setAttribute("stroke","#cbd5e1"); svg.appendChild(axisY);
const axisX = document.createElementNS(svg.namespaceURI,"line");
axisX.setAttribute("x1",PADL); axisX.setAttribute("x2",W-PADR); axisX.setAttribute("y1",H-PADB); axisX.setAttribute("y2",H-PADB);
axisX.setAttribute("stroke","#cbd5e1"); svg.appendChild(axisX);
// ticks Y
const tickVals = Array.from({length: Math.min(5, maxC)}, (_,i)=>Math.round((i+1)*maxC/Math.min(5,maxC)));
tickVals.forEach(v=>{
const y = yScale(v);
const line = document.createElementNS(svg.namespaceURI,"line");
line.setAttribute("x1",PADL); line.setAttribute("x2",W-PADR); line.setAttribute("y1",y); line.setAttribute("y2",y);
line.setAttribute("stroke","#eef2f7"); svg.appendChild(line);
const t = document.createElementNS(svg.namespaceURI,"text");
t.setAttribute("x",PADL-8); t.setAttribute("y",y+4); t.setAttribute("text-anchor","end");
t.setAttribute("font-size","11"); t.setAttribute("fill","#64748b"); t.textContent=v;
svg.appendChild(t);
});
// bars
years.forEach((y,i)=>{
const v = byYear[y].length;
const x = xScale(i);
const yTop = yScale(v);
const rect = document.createElementNS(svg.namespaceURI,"rect");
rect.setAttribute("x",x); rect.setAttribute("y",yTop);
rect.setAttribute("width", bw); rect.setAttribute("height", H-PADB - yTop);
rect.setAttribute("fill", "#0ea5e9"); rect.setAttribute("opacity","0.9");
rect.style.cursor="default";
svg.appendChild(rect);
const label = document.createElementNS(svg.namespaceURI,"text");
label.setAttribute("x", x + bw/2); label.setAttribute("y", H-PADB+16);
label.setAttribute("text-anchor","middle"); label.setAttribute("font-size","11"); label.setAttribute("fill","#475569");
label.textContent = y;
svg.appendChild(label);
if(v>0){
const vtxt = document.createElementNS(svg.namespaceURI,"text");
vtxt.setAttribute("x", x + bw/2); vtxt.setAttribute("y", yTop - 6);
vtxt.setAttribute("text-anchor","middle"); vtxt.setAttribute("font-size","11"); vtxt.setAttribute("fill","#0f172a");
vtxt.textContent = v;
svg.appendChild(vtxt);
}
});
};
// Table
const makeTable = (rows)=>{
tableCard.innerHTML="";
const h3 = document.createElement("h3"); h3.textContent="Details"; h3.style.margin="0 0 8px 0"; h3.style.fontSize="16px";
tableCard.appendChild(h3);
const info = document.createElement("div");
info.style.fontSize="12px"; info.style.color="#475569";
const providerCounts = groupBy(rows, r=>r.provider);
const summary = Object.keys(providerCounts).sort().map(p=>`${p}: ${providerCounts[p].length}`).join(" • ");
info.textContent = rows.length + " incidents" + (summary? " — " + summary : "");
info.style.marginBottom = "6px";
tableCard.appendChild(info);
const scroller = document.createElement("div");
scroller.style.overflowX="auto"; scroller.style.border="1px solid #e5e7eb";
scroller.style.borderRadius="10px"; tableCard.appendChild(scroller);
const table = document.createElement("table");
table.style.borderCollapse="separate"; table.style.borderSpacing="0";
table.style.width="100%"; table.style.fontSize="13px";
scroller.appendChild(table);
const th = (t)=>{ const e=document.createElement("th"); e.textContent=t;
e.style.textAlign="left"; e.style.padding="10px 12px"; e.style.background="#f8fafc"; e.style.position="sticky";
e.style.top="0"; e.style.borderBottom="1px solid #e5e7eb"; e.style.whiteSpace="nowrap"; return e; };
const headers = ["Date","Year","Provider","Service","Root cause / issue","Impact & duration"];
const thead = document.createElement("thead"); const trh=document.createElement("tr");
headers.forEach(h=>trh.appendChild(th(h))); thead.appendChild(trh); table.appendChild(thead);
const tbody = document.createElement("tbody");
rows.sort((a,b)=>parseUSDate(b.date)-parseUSDate(a.date)).forEach(r=>{
const tr=document.createElement("tr");
const td = (t)=>{ const e=document.createElement("td"); e.textContent=t; e.style.padding="10px 12px"; e.style.borderBottom="1px solid #f1f5f9"; e.style.verticalAlign="top"; return e; };
tr.appendChild(td(r.date));
tr.appendChild(td(String(r.year)));
const p = document.createElement("td"); p.textContent = r.provider; p.style.padding="10px 12px"; p.style.borderBottom="1px solid #f1f5f9"; p.style.whiteSpace="nowrap";
p.style.fontWeight="600"; p.style.color=colorFor(r.provider); tr.appendChild(p);
tr.appendChild(td(r.service));
tr.appendChild(td(r.cause));
tr.appendChild(td(r.impact));
tbody.appendChild(tr);
});
table.appendChild(tbody);
};
function currentRows(){ return outages.filter(o=>active.has(o.provider)); }
function update(){ makeTimeline(currentRows()); makeBar(currentRows()); makeTable(currentRows()); }
update();
// Resize handling for responsive SVGs
let resizeTO=null;
window.addEventListener("resize", ()=>{ clearTimeout(resizeTO); resizeTO=setTimeout(update,120); });
})();