+
+ {/* Header row */}
+
+
+
BSR vs Units Sold
+
+ Weekly correlation ยท {currentYear} ยท Top-level category BSR
+
+
+
+
+
+ {/* Marketplace tabs */}
+ {availableMarkets.length > 0 && (
+
+ {availableMarkets.map(m => {
+ const conf = MARKET_CONFIG[m];
+ const isActive = m === resolvedMarket;
+ return (
+
+ );
+ })}
+
+ )}
+
+ {/* Chart */}
+ {chartData.length === 0 ? (
+
+ No data available for {config.flag} {config.label}
+
+ ) : (
+
+
+
+
+
+
+ {/* Left axis: BSR rank */}
+
+
+ {/* Right axis: units sold */}
+ v >= 1_000 ? `${Math.round(v / 1_000)}K` : String(v)}
+ width={48}
+ label={{
+ value: 'Units Sold',
+ angle: 90,
+ position: 'insideRight',
+ offset: 8,
+ style: { fill: '#475569', fontSize: 10, fontWeight: 600 },
+ }}
+ />
+
+
+
+ {/* Units โ bars on right axis */}
+
+
+ {/* BSR โ line on left axis */}
+
+
+
+
+ )}
+
+ {/* Legend */}
+
+
+ {/* Pearson correlation note */}
+
+
+ Pearson r
+
+ {pearsonInfo.text}
+
+
+ {pearsonInfo.label}
+
+
+
+ {pearsonCorrelation !== null && pearsonCorrelation < -0.3
+ ? 'โ Rank improvement correlates with โ Units sold'
+ : pearsonCorrelation !== null && pearsonCorrelation > 0.3
+ ? 'โ Rank number correlates with โ Units โ unusual'
+ : pearsonCorrelation !== null
+ ? 'No strong BSRโUnits relationship detected'
+ : ''}
+
+
+
+
+ );
+};
diff --git a/components/VendorDataView.tsx b/components/VendorDataView.tsx
index 8340de7..b757ca4 100644
--- a/components/VendorDataView.tsx
+++ b/components/VendorDataView.tsx
@@ -1,12 +1,14 @@
import React, { useMemo } from 'react';
import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts';
-import { BSRRecord } from '../types';
+import { BSRRecord, CombinedKPIs } from '../types';
import { BuyBoxWarningBadge } from './BuyBoxWarningBadge';
+import { BSRUnitsCorrelationChart } from './BSRUnitsCorrelationChart';
interface VendorDataViewProps {
bsrData: BSRRecord[];
asinMetadata?: Map