: asapien/superpulse

commit 06dfb60bdd9c13e2d0c9843151e3c8ecc380e365
parent bb2cf79ddbec9020c324edf205c26644cbeaa1da
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Wed, 7 Oct 2026 17:14:54 +0530

Remove legacy TVA chart code
1 file changed, 0 insertions(+), 715 deletions(-)
M
logs.js
|
715
-------------------------------------------------------------------------------
diff --git a/logs.js b/logs.js
@@ -117,291 +117,6 @@ const tvaMetrics = {
     { name: 'SAIDAPET', days: 2.0 }
   ]
 };
-const tvaChartCheckpoints = ['Complaints Open', 'Invoice Actions', 'Delivery Person Leave', 'Refill Spread', 'Pendency', 'BPCL Deposit'];
-const tvaCheckpointIcons = ['warning', 'invoice', 'person', 'calendar', 'hourglass', 'deposit'];
-const tvaUsePlotIcons = true;
-const tvaShowAlertBadge = true;
-const tvaUpperThreshold = [75, 85, 70, 100, 100, 6];
-const tvaLowerThreshold = [-75, -85, -70, -100, -100, -3];
-const tvaAmberUpperThreshold = [52.5, 59.5, 49, 50, 33.33, 4];
-const tvaAmberLowerThreshold = [-52.5, -59.5, -49, -70, -70, -1];
-const tvaDoubleRedUpperThreshold = [Infinity, Infinity, Infinity, 150, Infinity, Infinity];
-const tvaShowDoubleRedAxis = false;
-const tvaMetricDatasetIndex = 6;
-let tvaReactiveChart = null;
-let tvaControl = null;
-let pendingTvaControlPatch = null;
-let tvaMetricData = [0, 0, 0, 0, 0, 6.5];
-let tvaChartMode = 'timeline';
-let tvaShowPointLabels = false;
-let tvaBlinkOn = true;
-let tvaBlinkIntervalId = null;
-let rangeFieldsInitialized = false;
-
-const reactiveThresholdBlastPlugin = {
-  id: 'reactiveThresholdBlast',
-  beforeDatasetsDraw(chart) {
-    const { ctx, chartArea } = chart;
-    const metricData = chart.data.datasets[tvaMetricDatasetIndex] && chart.data.datasets[tvaMetricDatasetIndex].data;
-    const metricMeta = chart.getDatasetMeta(tvaMetricDatasetIndex);
-    if (!chartArea || !metricData || !metricMeta || metricMeta.hidden) return;
-
-    ctx.save();
-
-    metricData.forEach((value, index) => {
-      const breached = value > tvaUpperThreshold[index] || value < tvaLowerThreshold[index];
-      const point = metricMeta.data[index];
-      if (!breached || !point) return;
-
-      const { x, y } = point.getProps(['x', 'y'], true);
-      const radius = 70;
-      const gradient = ctx.createRadialGradient(x, y, 4, x, y, radius);
-      gradient.addColorStop(0, 'rgba(255, 0, 85, 0.42)');
-      gradient.addColorStop(0.38, 'rgba(255, 0, 85, 0.18)');
-      gradient.addColorStop(1, 'rgba(255, 0, 85, 0)');
-
-      ctx.globalCompositeOperation = 'screen';
-      ctx.fillStyle = gradient;
-      ctx.beginPath();
-      ctx.arc(x, y, radius, 0, Math.PI * 2);
-      ctx.fill();
-
-      // Deterministic dither grain: gives the breach a static blast texture
-      // without introducing animation or frame-to-frame shimmer.
-      ctx.globalCompositeOperation = 'lighter';
-      for (let i = 0; i < 90; i += 1) {
-        const seed = (index + 1) * 997 + i * 37;
-        const angle = (Math.sin(seed) * 10000 % 1) * Math.PI * 2;
-        const distance = Math.sqrt(Math.abs(Math.sin(seed * 1.7))) * radius;
-        const dotX = x + Math.cos(angle) * distance;
-        const dotY = y + Math.sin(angle) * distance;
-        const alpha = Math.max(0, 1 - distance / radius) * 0.22;
-        const size = 0.6 + Math.abs(Math.sin(seed * 2.3)) * 1.8;
-
-        ctx.fillStyle = `rgba(255, ${Math.floor(20 + 45 * Math.abs(Math.sin(seed)))}, ${Math.floor(60 + 40 * Math.abs(Math.cos(seed)))}, ${alpha})`;
-        ctx.beginPath();
-        ctx.arc(dotX, dotY, size, 0, Math.PI * 2);
-        ctx.fill();
-      }
-    });
-
-    ctx.restore();
-  }
-};
-
-function drawTvaCheckpointIcon(ctx, type, x, y, color) {
-  ctx.save();
-  ctx.strokeStyle = color;
-  ctx.fillStyle = color;
-  ctx.lineWidth = 1.25;
-  ctx.lineCap = 'round';
-  ctx.lineJoin = 'round';
-
-  if (type === 'warning') {
-    ctx.beginPath();
-    ctx.moveTo(x, y);
-    ctx.lineTo(x - 5.5, y + 10.5);
-    ctx.lineTo(x + 5.5, y + 10.5);
-    ctx.closePath();
-    ctx.stroke();
-    ctx.beginPath();
-    ctx.moveTo(x, y + 3.5);
-    ctx.lineTo(x, y + 7.2);
-    ctx.stroke();
-    ctx.beginPath();
-    ctx.arc(x, y + 9.2, 0.6, 0, Math.PI * 2);
-    ctx.fill();
-  } else if (type === 'invoice') {
-    ctx.strokeRect(x - 5, y + 1, 10, 11.5);
-    [4, 7, 10].forEach(offset => {
-      ctx.beginPath();
-      ctx.moveTo(x - 3, y + offset);
-      ctx.lineTo(x + 3, y + offset);
-      ctx.stroke();
-    });
-  } else if (type === 'person') {
-    ctx.beginPath();
-    ctx.arc(x, y + 3.8, 2.8, 0, Math.PI * 2);
-    ctx.stroke();
-    ctx.beginPath();
-    ctx.moveTo(x - 5, y + 12);
-    ctx.quadraticCurveTo(x, y + 7.6, x + 5, y + 12);
-    ctx.stroke();
-  } else if (type === 'calendar') {
-    ctx.strokeRect(x - 5, y + 3, 10, 10);
-    ctx.beginPath();
-    ctx.moveTo(x - 5, y + 6);
-    ctx.lineTo(x + 5, y + 6);
-    ctx.moveTo(x - 2.8, y + 1);
-    ctx.lineTo(x - 2.8, y + 4);
-    ctx.moveTo(x + 2.8, y + 1);
-    ctx.lineTo(x + 2.8, y + 4);
-    ctx.stroke();
-    ctx.fillRect(x - 2.8, y + 8, 1.3, 1.3);
-    ctx.fillRect(x + 1.5, y + 8, 1.3, 1.3);
-  } else if (type === 'deposit') {
-    ctx.strokeRect(x - 5, y + 4, 10, 8);
-    ctx.beginPath();
-    ctx.moveTo(x - 6, y + 4);
-    ctx.lineTo(x, y + 0.5);
-    ctx.lineTo(x + 6, y + 4);
-    ctx.moveTo(x - 3, y + 7);
-    ctx.lineTo(x + 3, y + 7);
-    ctx.moveTo(x - 3, y + 10);
-    ctx.lineTo(x + 3, y + 10);
-    ctx.stroke();
-  } else if (type === 'hourglass') {
-    ctx.beginPath();
-    ctx.moveTo(x - 5, y + 1);
-    ctx.lineTo(x + 5, y + 1);
-    ctx.lineTo(x - 5, y + 12.5);
-    ctx.lineTo(x + 5, y + 12.5);
-    ctx.closePath();
-    ctx.stroke();
-    ctx.beginPath();
-    ctx.moveTo(x - 2.8, y + 4);
-    ctx.lineTo(x + 2.8, y + 4);
-    ctx.moveTo(x - 2.2, y + 10);
-    ctx.lineTo(x + 2.2, y + 10);
-    ctx.stroke();
-  }
-
-  ctx.restore();
-}
-
-function getTvaTrend(index) {
-  if (index <= 0) return 'flat';
-  const delta = tvaMetricData[index] - tvaMetricData[index - 1];
-  if (delta >= 15) return 'up';
-  if (delta <= -15) return 'down';
-  return 'flat';
-}
-
-function getTvaPointLabel(index) {
-  const label = tvaChartCheckpoints[index];
-  if (!label) return '';
-  if (label === 'Pendency') return `${tvaMetrics.pendencyDays}d`;
-  if (label === 'Invoice Actions') return `${tvaMetrics.invoiceActions}`;
-  if (label === 'Complaints Open') return `${tvaMetrics.complaintsOpen}`;
-  if (label === 'Delivery Person Leave') return `${tvaMetrics.deliveryPersonLeave}`;
-  return `${tvaMetricData[index]}%`;
-}
-
-function drawTvaPlotValueGroup(ctx, index, x, y, chartArea, blinkOn) {
-  const valueText = getTvaPointLabel(index);
-  const placeBelow = y - chartArea.top < 52;
-  const groupY = placeBelow ? y + 18 : y - 43;
-  const doubleRed = tvaMetricData[index] > tvaDoubleRedUpperThreshold[index];
-  const breached = doubleRed || tvaMetricData[index] > tvaUpperThreshold[index] || tvaMetricData[index] < tvaLowerThreshold[index];
-  const amber = breached || tvaMetricData[index] > tvaAmberUpperThreshold[index] || tvaMetricData[index] < tvaAmberLowerThreshold[index];
-
-  ctx.save();
-  ctx.font = 'bold 9px monospace';
-  const groupWidth = Math.max(28, ctx.measureText(valueText).width + 10);
-  const groupHeight = 31;
-  const groupX = Math.min(
-    Math.max(x - groupWidth / 2, chartArea.left + 2),
-    chartArea.right - groupWidth - 2
-  );
-
-  ctx.globalAlpha = breached ? (blinkOn ? 1 : 0.38) : 1;
-  ctx.fillStyle = doubleRed ? 'rgba(62, 0, 18, 0.94)' : breached ? 'rgba(42, 0, 16, 0.82)' : amber ? 'rgba(42, 28, 0, 0.78)' : 'rgba(10, 10, 10, 0.58)';
-  ctx.strokeStyle = doubleRed ? 'rgba(255, 20, 20, 1)' : breached ? 'rgba(255, 0, 85, 0.8)' : amber ? 'rgba(255, 204, 0, 0.72)' : 'rgba(255, 255, 255, 0.16)';
-  ctx.lineWidth = 1;
-  ctx.beginPath();
-  ctx.rect(groupX, groupY, groupWidth, groupHeight);
-  ctx.fill();
-  ctx.stroke();
-
-  const iconX = groupX + groupWidth / 2;
-  const iconY = groupY + 3;
-  drawTvaCheckpointIcon(ctx, tvaCheckpointIcons[index], iconX, iconY, '#ffffff');
-
-  ctx.fillStyle = '#ffffff';
-  ctx.textAlign = 'center';
-  ctx.textBaseline = 'middle';
-  ctx.fillText(valueText, groupX + groupWidth / 2, groupY + 24);
-  ctx.restore();
-}
-
-const reactiveZeroAxisPlugin = {
-  id: 'reactiveZeroAxis',
-  afterDraw(chart) {
-    if (tvaChartMode !== 'timeline') return;
-    const { ctx, scales: { y } } = chart;
-    if (!y) return;
-    const yZeroPixel = y.getPixelForValue(0);
-
-    ctx.save();
-    ctx.strokeStyle = '#00ffcc';
-    ctx.lineWidth = 2.5;
-    ctx.shadowColor = 'rgba(0, 255, 204, 0.38)';
-    ctx.shadowBlur = 7;
-    ctx.beginPath();
-    ctx.moveTo(0, yZeroPixel);
-    ctx.lineTo(chart.width, yZeroPixel);
-    ctx.stroke();
-    ctx.restore();
-  }
-};
-
-const reactivePointLabelsPlugin = {
-  id: 'reactivePointLabels',
-  afterDatasetsDraw(chart) {
-    if (tvaChartMode !== 'timeline') return;
-    const { ctx, chartArea } = chart;
-    const metricMeta = chart.getDatasetMeta(tvaMetricDatasetIndex);
-    if (!metricMeta || metricMeta.hidden) return;
-
-    metricMeta.data.forEach((point, index) => {
-      if (!tvaUsePlotIcons) return;
-      const { x, y } = point.getProps(['x', 'y'], true);
-      drawTvaPlotValueGroup(ctx, index, x, y, chartArea, tvaBlinkOn);
-    });
-
-    const activeIndexes = new Set((chart.tooltip && chart.tooltip.dataPoints || [])
-      .filter(point => point.datasetIndex === tvaMetricDatasetIndex)
-      .map(point => point.dataIndex));
-    if (tvaUsePlotIcons || (!tvaShowPointLabels && !activeIndexes.size)) return;
-
-    metricMeta.data.forEach((point, index) => {
-      if (!tvaShowPointLabels && !activeIndexes.has(index)) return;
-      const { x, y } = point.getProps(['x', 'y'], true);
-      const text = getTvaPointLabel(index);
-      const breached = tvaMetricData[index] > tvaUpperThreshold[index] || tvaMetricData[index] < tvaLowerThreshold[index];
-
-      ctx.save();
-      ctx.font = 'bold 10px monospace';
-      const width = ctx.measureText(text).width + 14;
-      const height = 20;
-      const boxX = x - width / 2;
-      const boxY = y - 34;
-
-      ctx.fillStyle = breached ? 'rgba(32, 0, 14, 0.86)' : 'rgba(8, 18, 17, 0.86)';
-      ctx.strokeStyle = breached ? 'rgba(255, 0, 85, 0.74)' : 'rgba(0, 255, 204, 0.55)';
-      ctx.lineWidth = 1;
-      ctx.beginPath();
-      ctx.roundRect(boxX, boxY, width, height, 8);
-      ctx.fill();
-      ctx.stroke();
-
-      ctx.beginPath();
-      ctx.moveTo(x - 4, boxY + height);
-      ctx.lineTo(x, boxY + height + 5);
-      ctx.lineTo(x + 4, boxY + height);
-      ctx.closePath();
-      ctx.fill();
-      ctx.stroke();
-
-      ctx.fillStyle = '#ffffff';
-      ctx.textAlign = 'center';
-      ctx.textBaseline = 'middle';
-      ctx.fillText(text, x, boxY + height / 2 + 1);
-      ctx.restore();
-    });
-  }
-};
-
 function getISTDateParts(date = new Date()) {
   const parts = new Intl.DateTimeFormat('en-CA', {
     timeZone: 'Asia/Kolkata',

@@ -427,45 +142,6 @@ function getDaysSinceISTMonthDay(monthOffset, day) {
   return Math.max(0, Math.floor((nowEpoch - targetEpoch) / (24 * 60 * 60 * 1000)));
 }
 
-function actionMetricPercent(count, direction = 1) {
-  return Math.max(-100, Math.min(100, count * 10 * direction));
-}
-
-function pendencyMetricPercent(currentDays, idealMaxDays, criticalDays) {
-  if (!criticalDays) return 0;
-  if (currentDays <= idealMaxDays) return 0;
-  return Math.max(0, Math.min(115, (currentDays / criticalDays) * 100));
-}
-
-function refillSpreadMetricPercent(currentDays, criticalDays, doubleRedDays) {
-  if (!criticalDays) return 0;
-  const maxDays = doubleRedDays || criticalDays;
-  return Math.max(0, Math.min(165, (currentDays / criticalDays) * 100, (currentDays / maxDays) * 150));
-}
-
-function syncTvaMetricThresholds() {
-  const refillSpreadIndex = tvaChartCheckpoints.indexOf('Refill Spread');
-  if (refillSpreadIndex !== -1 && tvaMetrics.criticalRefillSpreadDays) {
-    tvaAmberUpperThreshold[refillSpreadIndex] = (tvaMetrics.amberRefillSpreadDays / tvaMetrics.criticalRefillSpreadDays) * 100;
-    tvaUpperThreshold[refillSpreadIndex] = 100;
-    tvaDoubleRedUpperThreshold[refillSpreadIndex] = (tvaMetrics.doubleRedRefillSpreadDays / tvaMetrics.criticalRefillSpreadDays) * 100;
-  }
-
-  const depositIndex = tvaChartCheckpoints.indexOf('BPCL Deposit');
-  if (depositIndex !== -1) {
-    tvaAmberUpperThreshold[depositIndex] = 4;
-    tvaUpperThreshold[depositIndex] = 6;
-    tvaAmberLowerThreshold[depositIndex] = -1;
-    tvaLowerThreshold[depositIndex] = -3;
-  }
-
-  const pendencyIndex = tvaChartCheckpoints.indexOf('Pendency');
-  if (pendencyIndex !== -1 && tvaMetrics.criticalPendencyDays) {
-    tvaAmberUpperThreshold[pendencyIndex] = (tvaMetrics.idealPendencyMaxDays / tvaMetrics.criticalPendencyDays) * 100;
-    tvaUpperThreshold[pendencyIndex] = 100;
-  }
-}
-
 function finiteNumber(value) {
   const number = Number(value);
   return Number.isFinite(number) ? number : null;

@@ -526,7 +202,6 @@ function applyTvaMetricUpdate(payload) {
   setTvaMetricFromPayload('criticalPendencyDays', 'criticalPendencyDays', payload);
   setTvaPendencyAreasFromPayload(payload);
   setTvaRefillSpreadAreasFromPayload(payload);
-  syncTvaMetricThresholds();
   return true;
 }
 

@@ -550,52 +225,6 @@ function formatTvaMetricValue(index, value) {
   return `${value}%`;
 }
 
-function getActionChartMetrics() {
-  return [
-    actionMetricPercent(tvaMetrics.complaintsOpen),
-    actionMetricPercent(tvaMetrics.invoiceActions),
-    actionMetricPercent(tvaMetrics.deliveryPersonLeave),
-    refillSpreadMetricPercent(tvaMetrics.refillSpreadDays, tvaMetrics.criticalRefillSpreadDays, tvaMetrics.doubleRedRefillSpreadDays),
-    pendencyMetricPercent(tvaMetrics.pendencyDays, tvaMetrics.idealPendencyMaxDays, tvaMetrics.criticalPendencyDays),
-    tvaMetrics.bpclDepositLakhs
-  ];
-}
-
-function getTvaValueZoomBounds(values) {
-  const finiteValues = values.filter(value => Number.isFinite(value));
-  if (!finiteValues.length) return { min: -10, max: 10 };
-
-  let min = Math.min(0, ...finiteValues);
-  let max = Math.max(0, ...finiteValues);
-  if (min === max) {
-    min -= 10;
-    max += 10;
-  }
-
-  const span = max - min;
-  const padding = Math.max(8, span * 0.24);
-  return {
-    min: Math.floor(min - padding),
-    max: Math.ceil(max + padding)
-  };
-}
-
-function getPendencyAreaLabels() {
-  return tvaMetrics.pendencyAreas.map(area => area.name);
-}
-
-function getPendencyAreaDays() {
-  return tvaMetrics.pendencyAreas.map(area => area.days);
-}
-
-function getRefillSpreadAreaLabels() {
-  return tvaMetrics.refillSpreadAreas.map(area => area.name);
-}
-
-function getRefillSpreadAreaDays() {
-  return tvaMetrics.refillSpreadAreas.map(area => area.days);
-}
-
 window.setTvaControlData = function(data) {
   if (typeof data === 'string') data = JSON.parse(data);
   applyTvaMetricUpdate({ type: 'tva-metrics', ...(data || {}) });

@@ -606,348 +235,6 @@ window.getTvaControlData = function() {
   return tvaControl ? tvaControl.getData() : JSON.parse(JSON.stringify(tvaMetrics));
 };
 
-function ensureTvaChartControls(canvas) {
-  const container = canvas.closest('.action-chart-container');
-  if (!container || container.querySelector('.tva-chart-controls')) return;
-
-  const controls = document.createElement('div');
-  controls.className = 'tva-chart-controls';
-  const alertBadge = document.createElement('div');
-  alertBadge.className = 'tva-alert-badge';
-  alertBadge.hidden = true;
-  container.prepend(alertBadge);
-
-  controls.innerHTML = `
-    <button type="button" class="tva-chart-back" hidden>←</button>
-    <div class="tva-chart-heading">TVA REACTIVE CHANNEL</div>
-    <button type="button" class="tva-chart-fullscreen" title="Fullscreen chart" aria-label="Fullscreen chart">
-      <span class="tva-fullscreen-icon" aria-hidden="true"></span>
-    </button>
-  `;
-  container.prepend(controls);
-
-  controls.querySelector('.tva-chart-back').addEventListener('click', () => switchTvaChartMode('timeline'));
-  controls.querySelector('.tva-chart-fullscreen').addEventListener('click', () => toggleTvaChartFullscreen());
-}
-
-function syncTvaChartControls() {
-  const canvas = document.getElementById('tvaReactiveChart');
-  const container = canvas && canvas.closest('.action-chart-container');
-  if (!container) return;
-
-  const backButton = container.querySelector('.tva-chart-back');
-  const fullscreenButton = container.querySelector('.tva-chart-fullscreen');
-  const alertBadge = container.querySelector('.tva-alert-badge');
-  const heading = container.querySelector('.tva-chart-heading');
-  if (backButton) backButton.hidden = tvaChartMode === 'timeline';
-  if (heading) heading.textContent = tvaChartMode === 'pendency' ? 'PENDENCY AREA SCAN' : tvaChartMode === 'refill-spread' ? 'REFILL SPREAD AREA SCAN' : 'TVA REACTIVE CHANNEL';
-  if (fullscreenButton) {
-    const fullscreen = container.classList.contains('tva-chart-fullscreen-mode');
-    fullscreenButton.classList.toggle('is-restore', fullscreen);
-    fullscreenButton.title = fullscreen ? 'Restore chart' : 'Fullscreen chart';
-    fullscreenButton.setAttribute('aria-label', fullscreen ? 'Restore chart' : 'Fullscreen chart');
-  }
-  if (alertBadge) {
-    const hasDoubleRed = tvaMetricData.some((value, index) => value > tvaDoubleRedUpperThreshold[index]);
-    const hasCritical = hasDoubleRed || tvaMetricData.some((value, index) => value > tvaUpperThreshold[index] || value < tvaLowerThreshold[index]);
-    const hasAmber = hasCritical || tvaMetricData.some((value, index) => value > tvaAmberUpperThreshold[index] || value < tvaAmberLowerThreshold[index]);
-    alertBadge.hidden = !tvaShowAlertBadge || tvaChartMode !== 'timeline' || !hasAmber;
-    alertBadge.innerHTML = `<span class="tva-alert-icon" aria-hidden="true"></span>${hasDoubleRed ? 'DOUBLE RED' : hasCritical ? 'CRITICAL' : 'AMBER ALERT'}`;
-    alertBadge.classList.toggle('is-critical', hasCritical && !hasDoubleRed);
-    alertBadge.classList.toggle('is-double-red', hasDoubleRed);
-    alertBadge.classList.toggle('is-amber', !hasCritical);
-  }
-}
-
-function isTvaChartFullscreen() {
-  const canvas = document.getElementById('tvaReactiveChart');
-  const container = canvas && canvas.closest('.action-chart-container');
-  return !!(container && container.classList.contains('tva-chart-fullscreen-mode'));
-}
-
-function ensureTvaBlinkInterval() {
-  if (tvaBlinkIntervalId) return;
-  tvaBlinkIntervalId = setInterval(() => {
-    tvaBlinkOn = !tvaBlinkOn;
-    if (tvaReactiveChart && tvaChartMode === 'timeline') tvaReactiveChart.update('none');
-  }, 1100);
-}
-
-function toggleTvaChartFullscreen() {
-  const canvas = document.getElementById('tvaReactiveChart');
-  const container = canvas && canvas.closest('.action-chart-container');
-  if (!container) return;
-  container.classList.toggle('tva-chart-fullscreen-mode');
-  syncTvaChartControls();
-  if (tvaReactiveChart) {
-    tvaReactiveChart.resize();
-    tvaReactiveChart.update('none');
-  }
-}
-
-function switchTvaChartMode(mode) {
-  if (tvaChartMode === mode) return;
-  tvaChartMode = mode;
-  if (tvaReactiveChart) {
-    tvaReactiveChart.destroy();
-    tvaReactiveChart = null;
-  }
-  initActionRequiredChart();
-  updateActionRequiredChart();
-}
-
-function getTimelineChartConfig() {
-  return {
-    type: 'line',
-    data: {
-      labels: tvaChartCheckpoints,
-      datasets: [
-        {
-          label: 'Red Upper Threshold',
-          data: tvaUpperThreshold,
-          borderColor: 'rgba(255, 0, 85, 0.42)',
-          borderWidth: 2.2,
-          borderDash: [6, 6],
-          fill: false,
-          tension: 0.4,
-          pointRadius: 0,
-          hoverRadius: 0
-        },
-        {
-          label: 'Red Lower Threshold',
-          data: tvaLowerThreshold,
-          borderColor: 'rgba(255, 0, 85, 0.42)',
-          borderWidth: 2.2,
-          borderDash: [6, 6],
-          fill: false,
-          tension: 0.4,
-          pointRadius: 0,
-          hoverRadius: 0
-        },
-        {
-          label: 'Amber Upper Threshold',
-          data: tvaAmberUpperThreshold,
-          borderColor: 'rgba(255, 204, 0, 0.28)',
-          borderWidth: 1.45,
-          borderDash: [3, 5],
-          fill: false,
-          tension: 0.4,
-          pointRadius: 0,
-          hoverRadius: 0
-        },
-        {
-          label: 'Amber Lower Threshold',
-          data: tvaAmberLowerThreshold,
-          borderColor: 'rgba(255, 204, 0, 0.28)',
-          borderWidth: 1.45,
-          borderDash: [3, 5],
-          fill: false,
-          tension: 0.4,
-          pointRadius: 0,
-          hoverRadius: 0
-        },
-        {
-          label: 'Green Upper Threshold',
-          data: tvaUpperThreshold.map((value, index) => index === tvaChartCheckpoints.indexOf('BPCL Deposit') ? value : null),
-          borderColor: 'rgba(0, 255, 120, 0.5)',
-          borderWidth: 1.8,
-          borderDash: [4, 4],
-          spanGaps: false,
-          fill: false,
-          tension: 0.4,
-          pointRadius: 0,
-          hoverRadius: 0
-        },
-        {
-          label: 'Green Soft Threshold',
-          data: tvaAmberUpperThreshold.map((value, index) => index === tvaChartCheckpoints.indexOf('BPCL Deposit') ? value : null),
-          borderColor: 'rgba(120, 255, 160, 0.34)',
-          borderWidth: 1.4,
-          borderDash: [2, 5],
-          spanGaps: false,
-          fill: false,
-          tension: 0.4,
-          pointRadius: 0,
-          hoverRadius: 0
-        },
-        {
-          label: 'Timeline Metric',
-          data: tvaMetricData,
-          borderWidth: 3.5,
-          tension: 0.4,
-          fill: false,
-          borderColor: '#ff6200',
-          segment: {
-            borderColor: context => {
-              const index = context.p1DataIndex;
-              const value = tvaMetricData[index];
-              return value > tvaDoubleRedUpperThreshold[index] ? '#ff1a1a' : value > tvaUpperThreshold[index] || value < tvaLowerThreshold[index] ? '#ff0055' : '#ff6200';
-            }
-          },
-          pointBackgroundColor: context => {
-            const index = context.dataIndex;
-            const value = tvaMetricData[index];
-            return value > tvaDoubleRedUpperThreshold[index] ? '#ff1a1a' : value > tvaUpperThreshold[index] || value < tvaLowerThreshold[index] ? '#ff0055' : '#ffcc00';
-          },
-          pointStyle: context => getTvaTrend(context.dataIndex) === 'flat' ? 'circle' : 'triangle',
-          rotation: context => getTvaTrend(context.dataIndex) === 'down' ? 180 : 0,
-          pointRadius: context => getTvaTrend(context.dataIndex) === 'flat' ? 4 : 5.5,
-          pointHoverRadius: 8
-        }
-      ]
-    },
-    options: {
-      responsive: true,
-      maintainAspectRatio: false,
-      layout: { padding: { left: 2, right: 6, top: 8, bottom: 4 } },
-      onClick: (event, elements) => {
-        const activeElement = elements[0];
-        if (!activeElement || activeElement.datasetIndex !== tvaMetricDatasetIndex) return;
-
-        const idx = activeElement.index;
-        const label = tvaChartCheckpoints[idx];
-        if (label === 'Pendency') {
-          switchTvaChartMode('pendency');
-          return;
-        }
-        if (label === 'Refill Spread') {
-          switchTvaChartMode('refill-spread');
-          return;
-        }
-
-        const val = tvaMetricData[idx];
-        const maxBound = tvaUpperThreshold[idx];
-        const minBound = tvaLowerThreshold[idx];
-        let status = 'STABLE WITHIN AXIS BOUNDS';
-        if (val > maxBound) status = 'CRITICAL OVER-BREACH';
-        if (val < minBound) status = 'CRITICAL UNDER-BREACH';
-
-        alert(`Checkpoint: ${label}\nValue: ${formatTvaMetricValue(idx, val)}\nTolerance Band: ${minBound}% to ${maxBound}%\nStatus: ${status}`);
-      },
-      plugins: {
-        title: { display: false },
-        legend: { display: false },
-        tooltip: {
-          callbacks: {
-            title: items => items.length ? tvaChartCheckpoints[items[0].dataIndex] : '',
-            label: context => context.datasetIndex === tvaMetricDatasetIndex ? formatTvaMetricValue(context.dataIndex, context.parsed.y) : null
-          }
-        }
-      },
-      scales: {
-        x: {
-          offset: false,
-          border: { display: false },
-          grid: { color: '#222' },
-          ticks: {
-            color: '#ffffff',
-            font: { weight: 'bold', size: 10 },
-            callback: (_value, index) => tvaUsePlotIcons && !isTvaChartFullscreen() ? '' : tvaChartCheckpoints[index]
-          }
-        },
-        y: {
-          ...getTvaValueZoomBounds(tvaMetricData),
-          border: { display: false },
-          grid: {
-            color: context => context.tick.value === 0 ? 'rgba(0, 255, 204, 0)' : '#222',
-            lineWidth: 1
-          },
-          ticks: { display: false }
-        }
-      }
-    },
-    plugins: [reactiveZeroAxisPlugin, reactiveThresholdBlastPlugin, reactivePointLabelsPlugin]
-  };
-}
-
-function getAreaBarChartConfig({ labels, days, title, subtitle, tooltipSuffix, amberDays, criticalDays }) {
-  const maxDays = Math.max((criticalDays || amberDays || 1) + 1, ...days) + 0.5;
-
-  return {
-    type: 'bar',
-    data: {
-      labels,
-      datasets: [
-        {
-          label: 'Pendency Days',
-          data: days,
-          borderWidth: 1.2,
-          borderRadius: 8,
-          borderSkipped: false,
-          backgroundColor: context => {
-            const value = context.raw || 0;
-            return value > criticalDays ? 'rgba(255, 0, 85, 0.46)' : value > amberDays ? 'rgba(255, 204, 0, 0.38)' : 'rgba(0, 255, 204, 0.3)';
-          },
-          borderColor: context => {
-            const value = context.raw || 0;
-            return value > criticalDays ? '#ff0055' : value > amberDays ? '#ffcc00' : '#00ffcc';
-          }
-        }
-      ]
-    },
-    options: {
-      responsive: true,
-      maintainAspectRatio: false,
-      layout: { padding: { left: 12, right: 12, top: 24, bottom: 4 } },
-      plugins: {
-        title: { display: false },
-        subtitle: {
-          display: true,
-          text: subtitle,
-          color: '#ffcc00',
-          font: { size: 10, weight: 'bold' },
-          padding: { bottom: 10 }
-        },
-        legend: { display: false },
-        tooltip: {
-          callbacks: {
-            label: context => `${context.label}: ${context.parsed.y} ${tooltipSuffix}`
-          }
-        }
-      },
-      scales: {
-        x: {
-          grid: { color: '#242424' },
-          ticks: { color: '#ffffff', font: { weight: 'bold', size: 10 } }
-        },
-        y: {
-          min: 0,
-          max: maxDays,
-          grid: {
-            color: context => context.tick.value === amberDays ? 'rgba(255, 204, 0, 0.55)' : context.tick.value === criticalDays ? 'rgba(255, 0, 85, 0.55)' : '#242424',
-            lineWidth: context => context.tick.value === amberDays || context.tick.value === criticalDays ? 2 : 1
-          },
-          ticks: { color: '#aaaaaa', callback: value => `${value}d` }
-        }
-      }
-    }
-  };
-}
-
-function getPendencyChartConfig() {
-  return getAreaBarChartConfig({
-    labels: getPendencyAreaLabels(),
-    days: getPendencyAreaDays(),
-    title: 'PENDENCY AREA SCAN',
-    subtitle: `${tvaMetrics.pendencyDays} days overall · amber > ${tvaMetrics.idealPendencyMaxDays}d · critical > ${tvaMetrics.criticalPendencyDays}d`,
-    tooltipSuffix: 'days pending',
-    amberDays: tvaMetrics.idealPendencyMaxDays,
-    criticalDays: tvaMetrics.criticalPendencyDays
-  });
-}
-
-function getRefillSpreadChartConfig() {
-  return getAreaBarChartConfig({
-    labels: getRefillSpreadAreaLabels(),
-    days: getRefillSpreadAreaDays(),
-    title: 'REFILL SPREAD AREA SCAN',
-    subtitle: `${tvaMetrics.refillSpreadDays} days overall · amber > ${tvaMetrics.amberRefillSpreadDays}d · critical > ${tvaMetrics.criticalRefillSpreadDays}d`,
-    tooltipSuffix: 'days open',
-    amberDays: tvaMetrics.amberRefillSpreadDays,
-    criticalDays: tvaMetrics.criticalRefillSpreadDays
-  });
-}
-
 function applyLogsSettingsToDom() {
   document.body.classList.toggle('logs-dark', logsSettings.theme === 'dark');
   document.body.classList.toggle('logs-light', logsSettings.theme === 'light');

@@ -996,11 +283,9 @@ function initActionRequiredChart() {
 
   applyLogsSettingsToDom();
   tvaControl = createTvaControl({ canvas, config: tvaControlConfig, data: tvaMetrics });
-  tvaReactiveChart = tvaControl;
 }
 
 function updateActionRequiredChart() {
-  tvaMetricData = getActionChartMetrics();
   if (!tvaControl) initActionRequiredChart();
   if (!tvaControl) return;
   if (pendingTvaControlPatch) {