Fix All Referrers chart showing numeric indices instead of source names

categories belong under xaxis in ApexCharts (even for horizontal bars); they
were under yaxis, so Apex fell back to numeric category indices. Moved them to
xaxis.categories — left axis now labels each bar with its referrer domain.
This commit is contained in:
Ásgeir Thor Johnson
2026-06-18 23:51:08 +00:00
parent 34e15c1078
commit 875b86e8c5
+2 -2
View File
@@ -392,8 +392,8 @@ new ApexCharts(document.getElementById('allRefsChart'), {
series:[{name:'Peak 14-day views',data:allRefs.map(([,d])=>d.count)},{name:'Unique',data:allRefs.map(([,d])=>d.uniques)}],
colors:['#6366f1','#f59e0b'],
plotOptions:{bar:{horizontal:true,borderRadius:4,barHeight:'65%',dataLabels:{position:'top'}}},
xaxis:{labels:{formatter:v=>v>=1000?(v/1000).toFixed(0)+'k':v}},
yaxis:{labels:{style:{fontSize:'11px'}},categories:allRefs.map(([n])=>n)},
xaxis:{categories:allRefs.map(([n])=>n),labels:{formatter:v=>v>=1000?(v/1000).toFixed(0)+'k':v}},
yaxis:{labels:{style:{fontSize:'11px'}}},
dataLabels:{enabled:false},
tooltip:{y:{formatter:v=>fmt(v)}},
legend:{position:'top',horizontalAlign:'left',fontSize:'12px'},