Why the U.S. Spends So Much on Healthcare

A big reason is the high prices Americans pay for surgeries and drugs
By Andrew Mollica and Anna Wilde Mathews

April 6, 2026 5:30 am ET

.dashboard-container { max-width: 900px; width: 100%; } /* Typography */ .main-title { text-align: center; font-size: 22px; font-weight: bold; margin-bottom: 50px; color: #111; } /* Grid Layout */ .charts-grid { display: grid; grid-template-columns: repeat(4, 1fr); row-gap: 50px; column-gap: 30px; margin-bottom: 30px; } /* Individual Chart Container */ .chart-item { display: flex; flex-direction: column; align-items: center; } .chart-header { font-size: 14px; text-align: center; text-transform: uppercase; margin-bottom: 5px; height: 40px; /* Fixed height for title alignment */ display: flex; align-items: flex-end; justify-content: center; line-height: 1.15; font-weight: 400; color: #111; } /* Wrapper for the canvas to control its size */ .canvas-wrapper { position: relative; width: 120px; height: 180px; } /* Footer Notes */ .footer-notes { font-size: 14px; color: #666; line-height: 1.5; padding-top: 20px; margin-top: 20px; } /* Responsive Design */ @media (max-width: 768px) { .charts-grid { grid-template-columns: repeat(2, 1fr); } } @media (max-width: 480px) { .charts-grid { grid-template-columns: 1fr; } }

Cost of inpatient procedures

// 1. Registrasi Plugin Datalabels agar angka muncul di atas bar Chart.register(ChartDataLabels); // 2. Data prosedur const medicalData = [ { id: 'chart0', title: "TOTAL HIP
REPLACEMENT", peerValue: 10, usValue: 29 }, { id: 'chart1', title: "TOTAL KNEE
REPLACEMENT", peerValue: 11, usValue: 26 }, { id: 'chart2', title: "PROSTATECTOMY
(ROBOTIC)", peerValue: 11, usValue: 24 }, { id: 'chart3', title: "SLEEVE
GASTRECTOMY", peerValue: 9, usValue: 23 }, { id: 'chart4', title: "SPINAL
DECOMPRESSION", peerValue: 7, usValue: 21 }, { id: 'chart5', title: "CHOLECYSTECTOMY", peerValue: 5, usValue: 18 }, { id: 'chart6', title: "CHILDBIRTH
(C-SECTION)", peerValue: 4, usValue: 14 }, { id: 'chart7', title: "APPENDECTOMY", peerValue: 4, usValue: 14 } ]; const container = document.getElementById('charts-container'); // 3. Buat kerangka HTML (canvas) untuk setiap grafik medicalData.forEach(item => { container.innerHTML += `
${item.title}
`; }); // 4. Inisialisasi Chart.js untuk masing-masing canvas medicalData.forEach(item => { const ctx = document.getElementById(item.id).getContext('2d'); new Chart(ctx, { type: 'bar', data: { labels: ['Peer', 'U.S.'], datasets: [{ data: [item.peerValue, item.usValue], backgroundColor: [ '#9FD0D7', // Light blue untuk Peer '#31737B' // Dark teal untuk U.S. ], // Mengatur ketebalan batang agar mirip desain asli barPercentage: 0.7, categoryPercentage: 1.0 }] }, options: { responsive: true, maintainAspectRatio: false, layout: { padding: { top: 25 // Ruang kosong di atas agar teks angka tidak terpotong } }, scales: { y: { display: false, // Sembunyikan sumbu Y sepenuhnya max: 32 // Set maksimal sedikit di atas nilai tertinggi (29) }, x: { grid: { display: false, drawBorder: false // Menghilangkan garis sumbu X }, ticks: { font: { size: 16, family: "'Helvetica Neue', Helvetica, Arial, sans-serif" }, color: '#111' } } }, plugins: { legend: { display: false // Sembunyikan legenda }, tooltip: { enabled: false // Sembunyikan tooltip saat dihover (opsional, karena WSJ statis) }, datalabels: { anchor: 'end', align: 'end', offset: 4, formatter: (value) => '$' + value + 'k', font: { size: 18, family: "'Helvetica Neue', Helvetica, Arial, sans-serif" }, color: '#111' } }, // Menghilangkan interaksi hover agar terasa seperti grafik statis jurnalistik hover: {mode: null}, animation: false // Matikan animasi agar langsung tampil (opsional) } }); });

Americans spend more on healthcare than anyone else in the world. Just insuring a family here costs nearly $27,000 a year, enough to buy a car.

The main cause: Prices are far higher in the U.S. for the same medical products and services, from surgeries to drugs.

American patients have also been using more care recently, including costly hospital treatment and expensive new drugs for weight loss. That has pushed up spending as well.

Here are some of the factors that make U.S. healthcare the most expensive.

.dashboard-container { max-width: 800px; width: 100%; } /* Typography */ .main-title { font-family: Georgia, 'Times New Roman', serif; font-size: 24px; font-weight: bold; margin-bottom: 12px; color: #111; } .sub-title { font-family: Georgia, 'Times New Roman', serif; font-size: 16px; color: #333; margin-bottom: 40px; margin-left: 30px; } .section-header { font-size: 15px; font-weight: bold; margin-bottom: 10px; color: #111; } /* Chart Sections */ .drug-section { margin-bottom: 35px; } .drug-title { font-size: 15px; margin-bottom: 15px; } .drug-title strong { font-weight: bold; color: #111; } .drug-title span { font-weight: normal; color: #444; } /* Rows & Lollipop Layout */ .chart-area { padding-right: 60px; } .chart-row { display: flex; align-items: center; height: 24px; } .row-label { width: 105px; text-align: right; padding-right: 12px; font-size: 14px; color: #222; } .row-track-area { flex-grow: 1; height: 100%; border-left: 2px solid #31737B; display: flex; align-items: center; position: relative; } /* The Static Bar (Lollipop Line & Dot) */ .track-group { position: relative; height: 100%; display: flex; align-items: center; /* Transisi dihapus */ } .track-line { width: 100%; height: 3px; } .track-dot { position: absolute; right: 0; top: 50%; width: 12px; height: 12px; border-radius: 50%; transform: translate(50%, -50%); } /* Value Text */ .row-value { position: absolute; left: 100%; top: 50%; transform: translateY(-50%); padding-left: 12px; font-size: 14.5px; color: #111; /* Opacity 0 dihapus, jadi langsung terlihat */ opacity: 1; } /* Colors matching WSJ */ .us .track-line, .us .track-dot { background-color: #31737B; } .peer .track-line, .peer .track-dot { background-color: #9FD0D7; } /* Footer Notes */ .footer-notes { font-size: 13px; color: #666; line-height: 1.5; padding-top: 20px; margin-top: 20px; border-top: 1px solid #eee; } .footer-notes p { margin-bottom: 4px; }

Prescription drugs cost a lot more in the U.S.

Most other nations force drugmakers to accept lower rates, while the U.S. government generally doesn’t.

Median cost of select drugs, 2022
// Data obat const drugData = [ { name: "Herceptin", desc: "(For cancer; 450mg injection)", data: [ { country: "USA", value: 6819, type: "us" }, { country: "Germany", value: 2599, type: "peer" }, { country: "South Africa", value: 1620, type: "peer" }, { country: "Greece", value: 1418, type: "peer" }, { country: "UK", value: 1360, type: "peer" }, { country: "Spain", value: 1338, type: "peer" } ] }, { name: "Enbrel", desc: "(For arthritis; 50mg/ml - 4 syringes)", data: [ { country: "USA", value: 6238, type: "us" }, { country: "Germany", value: 1043, type: "peer" }, { country: "Spain", value: 802, type: "peer" }, { country: "Greece", value: 668, type: "peer" }, { country: "South Africa", value: 516, type: "peer" } ] }, { name: "Eliquis", desc: "(For stroke and blood clots; 5mg - 60 pills)", data: [ { country: "USA", value: 513, type: "us" }, { country: "Spain", value: 96, type: "peer" }, { country: "Germany", value: 90, type: "peer" }, { country: "Greece", value: 72, type: "peer" }, { country: "South Africa", value: 60, type: "peer" } ] } ]; const GLOBAL_MAX = 7000; // Render HTML const lollipop = document.getElementById('lollipop-charts'); let htmlContent = ''; drugData.forEach(drug => { htmlContent += `
${drug.name} ${drug.desc}
`; drug.data.forEach(row => { const targetWidth = (row.value / GLOBAL_MAX) * 100; // Lebar (width) sekarang langsung disuntikkan ke inline style tanpa menunggu JS timeout htmlContent += `
${row.country}
$${row.value.toLocaleString('en-US')}
`; }); htmlContent += `
`; }); // Tampilkan hasil akhir lollipop.innerHTML = htmlContent; // Tidak perlu lagi fungsi setTimeout untuk memicu animasi
.container { max-width: 800px; width: 100%; padding: 20px; } /* Header Typography */ .title { font-family: Georgia, 'Times New Roman', serif; font-size: 22px; font-weight: bold; color: #111; margin-bottom: 15px; } .description { font-family: Georgia, 'Times New Roman', serif; font-size: 15px; line-height: 1.6; color: #333; margin-bottom: 20px; margin-left: 20px; /* Indent matching the design */ } /* Peta Placeholder (Karena tidak bisa di-render native murni) */ .map-placeholder { width: 100%; background-color: #eaeaea; display: flex; align-items: center; justify-content: center; border: 1px dashed #ccc; margin-bottom: 40px; color: #666; font-style: italic; } /* --- STACKED BAR CHART SECTION --- */ .chart-section { margin-top: 30px; } .chart-title { font-size: 15px; font-weight: bold; color: #111; margin-bottom: 25px; } /* Teks Label di Atas Bar */ .labels-top { display: flex; width: 100%; margin-bottom: 5px; font-size: 14px; color: #333; position: relative; } .label-low { width: 6%; text-align: left; } .label-high { width: 43%; text-align: center; /* Menggeser teks agar pas di tengah area warna biru muda */ transform: translateX(-15%); } .label-higher { width: 30%; text-align: center; /* Menggeser teks agar pas di tengah area warna teal gelap */ transform: translateX(-10%); } .label-monopoly { width: 21%; text-align: right; } /* Stacked Bar Container */ .stacked-bar { display: flex; width: 100%; height: 28px; /* Ketebalan bar */ margin-bottom: 15px; /* Tick marks on top edge simulating an axis */ border-top: 1px solid #ccc; position: relative; } /* Tick marks (Garis kecil penanda batas) */ .stacked-bar::before, .stacked-bar::after, .tick-mark-1, .tick-mark-2 { content: ''; position: absolute; top: -4px; width: 1px; height: 4px; background-color: #888; } .stacked-bar::before { left: 0; } .stacked-bar::after { right: 0; } .tick-mark-1 { left: 49%; } /* 6% + 43% */ .tick-mark-2 { left: 79%; } /* 49% + 30% */ /* Segmen dalam Bar */ .segment { display: flex; align-items: center; padding: 0 10px; font-size: 15px; height: 100%; /* Garis pemisah putih tipis */ border-right: 1px solid #fff; } .segment:last-child { border-right: none; } /* Styling Tiap Segmen */ .seg-low { width: 6%; background-color: #B2D1D6; /* Abu-biru pucat */ color: #111; justify-content: flex-start; } .seg-high { width: 43%; background-color: #88C5D3; /* Biru muda */ color: #111; justify-content: center; } .seg-higher { width: 30%; background-color: #0E7B8B; /* Teal gelap */ color: #fff; justify-content: center; } .seg-monopoly { width: 21%; background-color: #000000; /* Hitam */ color: #fff; justify-content: center; text-align: right; padding-right: 15px; justify-content: flex-end; } /* Footer Notes */ .footer { margin-top: 20px; font-size: 13px; color: #666; line-height: 1.4; }

Big hospitals can charge higher rates because of consolidation

One reason for higher surgery and other prices: Many cities and communities are now dominated by a single hospital system, partly because hospitals have been merging in recent years.

The consolidation has given hospital systems leverage to command higher rates during negotiations with health insurers. The insurers would lose business if powerful hospitals shut them out.

Map of US hospitals by market concentration, 2025
Share of hospitals by concentration level
Low or moderate
High
Higher
Monopoly
6%
43%
30%
21%
.chart-container { max-width: 100%; width: 100%; } /* Typography */ h2.title { font-family: Georgia, 'Times New Roman', serif; font-size: 22px; font-weight: bold; color: #111; margin-bottom: 15px; letter-spacing: -0.2px; } p.subtitle { font-family: Georgia, 'Times New Roman', serif; font-size: 16px; margin-left: 35px; margin-bottom: 40px; color: #222; } .chart-header { font-weight: bold; font-size: 14.5px; color: #111; margin-bottom: 10px; margin-left: 10px; } /* Main Chart Area */ .chart-layout { position: relative; height: 520px; display: flex; width: 100%; margin-bottom: 25px; } /* --- LEFT LABELS --- */ .left-labels { width: 250px; position: relative; } /* Admin Label */ .lbl-admin { position: absolute; top: 0; right: 20px; text-align: right; width: 100%; transform: translateY(-8px); } .lbl-admin .lbl-title { color: #1C5A5B; /* Dark Teal WSJ */ font-weight: bold; font-size: 15px; margin-bottom: 2px; } .lbl-admin .lbl-desc { font-size: 14.5px; line-height: 1.35; color: #222; } /* Garis penunjuk label Admin */ .lbl-admin::after { content: ''; position: absolute; top: 10px; right: -20px; width: 14px; height: 1px; background: #111; } /* Medical Label */ .lbl-medical { position: absolute; top: 62.5%; /* Di tengah baris Medical (antara 25% dan 100%) */ right: 20px; text-align: right; width: 100%; transform: translateY(-50%); } .lbl-medical .lbl-title { color: #888; font-weight: bold; font-size: 15px; margin-bottom: 2px; } .lbl-medical .lbl-desc { font-size: 14.5px; line-height: 1.35; color: #222; } /* Garis penunjuk label Medical */ .lbl-medical::after { content: ''; position: absolute; top: 10px; right: -20px; width: 14px; height: 1px; background: #888; } /* --- LEFT BAR --- */ .bar-left { width: 50px; height: 100%; display: flex; flex-direction: column; position: relative; z-index: 2; } .bar-left-top { height: 25%; background: #1C5A5B; color: white; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: normal; } .bar-left-bottom { height: 75%; background: #B9B9B9; color: #222; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: normal; } /* --- MIDDLE CURVE CONNECTOR --- */ .curve-connector { width: 180px; height: 100%; position: relative; margin-right: 15px; /* Jarak antara kurva dan bar kanan */ } .curve-connector svg { width: 100%; height: 100%; display: block; } /* Garis batas dengan ticks (Kanan Kurva) */ .curve-axis { position: absolute; top: 0; right: -15px; /* Menempel pada bar kanan */ width: 1px; height: 100%; background: #111; } .curve-axis::before, .curve-axis::after { content: ''; position: absolute; right: 0; width: 5px; height: 1px; background: #111; } .curve-axis::before { top: 0; } .curve-axis::after { bottom: 0; } /* --- RIGHT BAR --- */ .bar-right { width: 48px; height: 100%; display: flex; flex-direction: column; position: relative; z-index: 2; } .seg { display: flex; align-items: center; justify-content: center; font-size: 14.5px; } /* Pewarnaan persis WSJ */ .seg-39 { height: 39%; background: #226464; color: white; } .seg-21 { height: 21%; background: #2F888C; color: white; } .seg-14 { height: 14%; background: #3FB1BD; color: white; } .seg-11 { height: 11%; background: #AED5DB; color: #111; } .seg-9 { height: 9%; background: #D3E7EA; color: #111; } .seg-6 { height: 6%; background: #F1F6F7; color: #111; } /* --- RIGHT LABELS --- */ .right-labels { width: 260px; position: relative; margin-left: 10px; } .lbl-right { position: absolute; left: 15px; transform: translateY(-50%); font-size: 14.5px; line-height: 1.35; color: #222; } /* Garis penunjuk label kanan */ .lbl-right::before { content: ''; position: absolute; top: 50%; left: -15px; width: 10px; height: 1px; background: #888; } /* Posisi Y berdasarkan persen */ .pos-39 { top: 19.5%; } .pos-21 { top: 49.5%; } .pos-14 { top: 67%; } .pos-11 { top: 79.5%; } .pos-9 { top: 89.5%; } /* Label 6 (Other) dengan Bracket */ .pos-6 { top: 100%; left: 25px; } .pos-6::before { display: none; } .bracket { position: absolute; top: -16px; left: -15px; width: 10px; height: 25px; border-left: 1px solid #111; border-bottom: 1px solid #111; } .bracket::before { content: ''; position: absolute; top: 0; left: -5px; width: 5px; height: 1px; background: #111; } /* Footer */ .footer-notes { font-size: 13.5px; color: #666; line-height: 1.5; } /* Responsiveness */ @media (max-width: 768px) { .chart-layout { height: 600px; } .left-labels { width: 140px; } .lbl-admin .lbl-desc, .lbl-medical .lbl-desc { display: none; } .curve-connector { width: 100px; } .right-labels { width: 180px; } }

The U.S. spends far more than other countries on administration

The costs include functions like billing, claims processing and customer service.

U.S. healthcare spending
Administrative spending
Activities in support of
delivery of care, like
payment transactions,
back-office corporate and
customer service.
Medical spending
Direct delivery of care by
providers such as doctors
and nurses.
25%
75
39%
21
14
11
9
6
Industry-agnostic
corporate functions
Financial transactions
ecosystem
Industry-specific
operational functions
Administrative clinical
support functions
Customer and
patient services
Other
.dashboard-container { max-width: 100%; width: 100%; } /* Typography */ .main-title { font-family: Georgia, 'Times New Roman', serif; font-size: 24px; font-weight: bold; color: #111; margin-bottom: 12px; } .sub-title { font-family: Georgia, 'Times New Roman', serif; font-size: 16.5px; color: #333; margin-bottom: 35px; margin-left: 35px; /* Indentasi khas WSJ */ line-height: 1.5; } .section-header { font-size: 15px; font-weight: bold; color: #111; margin-bottom: 25px; } /* Dual Column Layout */ .chart-layout { display: flex; gap: 20px; width: 100%; margin-bottom: 20px; } .chart-column { width: 50%; display: flex; flex-direction: column; } .column-title { text-align: center; font-size: 14.5px; text-transform: uppercase; color: #333; margin-bottom: 15px; } /* Rows & Lollipop Layout */ .chart-row { display: flex; align-items: center; height: 28px; /* Jarak antar baris */ } .row-label { width: 130px; text-align: right; padding-right: 12px; font-size: 14.5px; color: #222; } .row-track-area { flex-grow: 1; height: 100%; border-left: 1px solid #111; /* Garis vertikal sumbu Y */ display: flex; align-items: center; position: relative; } /* The Static Bar (Lollipop Line & Dot) */ .track-group { position: relative; height: 100%; display: flex; align-items: center; } .track-line { width: 100%; height: 4px; /* Ketebalan garis batang */ } .track-dot { position: absolute; right: 0; top: 50%; width: 13px; height: 13px; border-radius: 50%; transform: translate(50%, -50%); } /* Value Text */ .row-value { position: absolute; left: 100%; top: 50%; transform: translateY(-50%); padding-left: 12px; font-size: 14.5px; color: #111; } /* WSJ Colors */ /* U.S. (Top Row) is Dark Teal */ .us .track-line, .us .track-dot { background-color: #31737B; } /* Other countries are Light Blue */ .peer .track-line, .peer .track-dot { background-color: #9FD0D7; } /* Customizing specific labels like United States* and United Kingdom† */ .row-label sup { font-size: 11px; } /* Footer Notes */ .footer-notes { font-size: 13.5px; color: #666; line-height: 1.5; padding-top: 10px; margin-top: 15px; } .footer-notes p { margin-bottom: 2px; } /* Responsiveness */ @media (max-width: 768px) { .chart-layout { flex-direction: column; gap: 40px; } .chart-column { width: 100%; } .row-label { width: 110px; } }

Labor costs are higher

American doctors and nurses generally make more than their counterparts in other countries, another factor that can drive up the cost of care.

Mean annual income for select countries, in thousands, 2023
GENERALIST PHYSICIANS
HOSPITAL NURSES
// 1. Data sesuai dengan gambar const physiciansData = [ { country: "United States*", value: 245, type: "us" }, { country: "Netherlands", value: 157, type: "peer" }, { country: "Sweden", value: 128, type: "peer" }, { country: "Spain", value: 124, type: "peer" }, { country: "United Kingdom†", value: 99, type: "peer" }, { country: "Türkiye", value: 98, type: "peer" }, { country: "Israel", value: 70, type: "peer" }, { country: "Czechia", value: 70, type: "peer" }, { country: "Portugal", value: 69, type: "peer" }, { country: "Mexico", value: 49, type: "peer" } ]; const nursesData = [ { country: "", value: 97, type: "us" }, // Label kosong di kolom kanan { country: "", value: 82, type: "peer" }, { country: "", value: 56, type: "peer" }, { country: "", value: 67, type: "peer" }, { country: "", value: 53, type: "peer" }, { country: "", value: 48, type: "peer" }, { country: "", value: 68, type: "peer" }, { country: "", value: 52, type: "peer" }, { country: "", value: 35, type: "peer" }, { country: "", value: 35, type: "peer" } ]; // 2. Skala Global // Dalam gambar, garis USA Physicians ($245k) hampir menyentuh ujung kontainer, // jadi kita gunakan batas skala ~270 agar proporsional dan tidak terpotong. const G_MAX = 270; // 3. Fungsi Render Baris (Row) function renderRows(dataArray, containerId, hasLabels) { const container = document.getElementById(containerId); let htmlContent = ''; dataArray.forEach(row => { const targetWidth = (row.value / G_MAX) * 100; // Format tanda * dan † menjadi elemen let formattedCountry = row.country .replace('*', '*') .replace('†', '†'); // Jika nilai di atas 200 (USA), tambahkan tanda dollar '$' let valueText = row.value > 200 ? `$${row.value}` : row.value; // Jika parameter hasLabels false, sembunyikan container label let labelDiv = hasLabels ? `
${formattedCountry}
` : ``; htmlContent += `
${labelDiv}
${valueText}
`; }); container.innerHTML = htmlContent; } // 4. Eksekusi Render // Kolom Kiri (Dengan label nama negara) renderRows(physiciansData, 'chart-physicians', true); // Kolom Kanan (Tanpa label nama negara, sama persis seperti gambar) renderRows(nursesData, 'chart-nurses', false);
.chart-container { max-width: 100%; width: 100%; } /* Typography matching WSJ */ h2.title { font-family: Georgia, 'Times New Roman', serif; font-size: 24px; font-weight: bold; color: #111; margin-bottom: 15px; letter-spacing: -0.2px; } p.subtitle { font-family: Georgia, 'Times New Roman', serif; font-size: 16px; margin-left: 35px; margin-bottom: 40px; color: #222; } .chart-header { font-weight: bold; font-size: 14.5px; color: #111; margin-bottom: 20px; } /* Canvas Wrapper */ .canvas-wrapper { position: relative; height: 400px; /* Tinggi yang cukup untuk menampilkan grafik garis dengan jelas */ width: 100%; margin-bottom: 25px; } /* Footer */ .footer-notes { font-size: 13.5px; color: #666; line-height: 1.5; margin-top: 10px; }

Americans are using more healthcare

Healthcare utilization has grown faster than prices in the most recent years.

Price and quantity indexes of health services, annual change
// Membungkus dalam IIFE untuk mencegah konflik nama variabel dengan chart lain di dashboard (() => { // Registrasi plugin Chart.register(ChartDataLabels); // Data Ekstraksi dari Gambar // Membuat label dari 1979 hingga 2024 untuk mengakomodasi seluruh garis waktu const years = []; for (let y = 1979; y <= 2024; y++) { years.push(y); } // Estimasi visual data (kurang lebih 46 titik data) const priceData = [ 12.0, 12.1, 11.2, 8.5, 6.0, 5.8, 6.4, 7.8, 8.6, 8.2, 7.0, 5.2, 4.0, 3.4, 1.8, 1.8, 1.8, 2.2, 3.0, 3.4, 2.5, 3.6, 3.5, 3.0, 2.9, 3.5, 2.7, 2.7, 2.4, 1.6, 1.6, 1.3, 1.0, 0.5, 1.0, 1.4, 1.8, 2.8, 2.3, 2.0, 2.6, 2.1, 2.5 ]; const qtyData = [ 2.5, 4.8, 0.0, 2.8, 1.2, 2.8, 2.8, 4.0, 3.7, 0.8, 3.2, 1.6, 2.8, 0.2, 0.6, 2.0, 2.0, 2.9, 3.0, 1.4, 3.0, 4.8, 5.8, 2.5, 3.2, 3.0, 2.0, 2.2, 2.2, 2.0, 1.2, 1.2, 1.6, 0.6, 5.2, 3.6, 2.0, 2.2, 3.5, -7.5, 8.9, 4.0, 6.0, 5.2 ]; // Konfigurasi Kustom Garis Tebal (Sumbu X pada nilai 0) const zeroLinePlugin = { id: 'zeroLinePlugin', beforeDraw(chart) { const ctx = chart.ctx; const xAxis = chart.scales.x; const yAxis = chart.scales.y; // Cari posisi pixel untuk Y = 0 const yZero = yAxis.getPixelForValue(0); ctx.save(); ctx.beginPath(); ctx.moveTo(xAxis.left, yZero); ctx.lineTo(xAxis.right, yZero); ctx.lineWidth = 1.5; ctx.strokeStyle = '#111'; // Hitam ctx.stroke(); ctx.restore(); } }; const ctxUtil = document.getElementById('utilizationChart').getContext('2d'); new Chart(ctxUtil, { type: 'line', plugins: [zeroLinePlugin], // Masukkan plugin garis nol data: { labels: years, datasets: [ { label: 'Price', data: priceData, borderColor: '#A8B1B6', // Abu-abu terang (Mirip gambar) backgroundColor: 'rgba(230, 235, 235, 0.4)', // Abu-abu transparan untuk fill borderWidth: 2, pointRadius: 0, // Hilangkan titik pointHoverRadius: 0, fill: true, tension: 0.1 // Sedikit melengkung }, { label: 'Quantity', data: qtyData, borderColor: '#19829A', // Teal terang (Mirip gambar) backgroundColor: 'rgba(25, 130, 154, 0.1)', // Teal transparan untuk fill borderWidth: 2, pointRadius: 0, pointHoverRadius: 0, fill: true, tension: 0.1 } ] }, options: { responsive: true, maintainAspectRatio: false, layout: { padding: { right: 80, // Ruang untuk label 'Quantity' dan 'Price' di kanan top: 40 // Ruang untuk label kotak teks panjang } }, scales: { y: { min: -10, max: 15, grid: { color: '#e4e4e4', // Garis horisontal tipis drawBorder: false, // Hilangkan garis tebal di paling kiri sumbu Y lineWidth: 1 }, ticks: { stepSize: 5, font: { size: 14, family: "'Helvetica Neue', Helvetica, Arial, sans-serif" }, color: '#333', callback: function(value) { // Tambahkan tanda % hanya di angka 15 if (value === 15) return '15%'; // Berikan spasi pada angka minus agar sejajar if (value = 1980 && year <= 2020) { return year; } return ''; } } } }, plugins: { legend: { display: false // Sembunyikan legenda standar }, tooltip: { enabled: false // Grafik WSJ biasanya statis }, datalabels: { // Menangani penempatan label khusus di akhir garis dan callout box display: function(context) { // Tampilkan label hanya pada titik data terakhir yang ada nilainya const isLastPrice = context.datasetIndex === 0 && context.dataIndex === priceData.length - 1; const isLastQty = context.datasetIndex === 1 && context.dataIndex === qtyData.length - 1; // Callout box "Healthcare use has grown..." kita pasang di puncak Quantity (sekitar tahun 2021) const isCallout = context.datasetIndex === 1 && context.dataIndex === 41; // Index 41 = tahun 2020 return isLastPrice || isLastQty || isCallout; }, formatter: function(value, context) { if (context.datasetIndex === 0 && context.dataIndex === priceData.length - 1) return 'Price'; if (context.datasetIndex === 1 && context.dataIndex === qtyData.length - 1) return 'Quantity'; if (context.datasetIndex === 1 && context.dataIndex === 41) return 'Healthcare use has grown faster than\nprices in recent years.'; return ''; }, color: function(context) { if (context.datasetIndex === 0) return '#777'; // Warna label Price if (context.datasetIndex === 1 && context.dataIndex === qtyData.length - 1) return '#19829A'; // Warna label Quantity return '#222'; // Warna kotak callout }, font: function(context) { const isCallout = context.dataIndex === 41; return { size: isCallout ? 16 : 17, family: "'Helvetica Neue', Helvetica, Arial, sans-serif", weight: isCallout ? 'normal' : 'normal' }; }, textAlign: 'right', // Untuk callout box agar rata kanan anchor: function(context) { if (context.dataIndex === 41) return 'top'; return 'end'; }, align: function(context) { if (context.dataIndex === 41) return 'top'; return 'right'; }, offset: function(context) { if (context.dataIndex === 41) return 25; // Jarak kotak callout ke atas return 10; // Jarak label akhir dari garis } } }, // NONAKTIFKAN ANIMASI agar memuat secara instan seperti gambar statis animation: false } }); })();

Log in

Learn More About SCALE Community

Connect with us to explore how our trusted solutions can help you reach your goals. Fill out the form below, and a member of our team will follow up with personalized details for your organization.

If you are a community member

Login SCALE Community

Or

Join SCALE Community

We are excited for you to share in the benefits of SCALE community’s healthcare focus materials. If you are not currently a member sign up now to get unlimited access to all our materials.