| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /tmp/ |
Upload File : |
(function(){
// ===== Performance-Dashboard: kombiniertes Diagramm (Balken Provision + 3 Linien) =====
(function(){
var host=document.querySelector('.pdash-chart[data-pdash]');
if(!host) return;
var D; try{ D=JSON.parse(host.getAttribute('data-pdash')); }catch(e){ return; }
var axis=D.axis||[]; if(!axis.length) return;
var SVGNS='http://www.w3.org/2000/svg';
var W=1000,H=320,padL=46,padR=52,padT=14,padB=26;
var plotW=W-padL-padR, plotH=H-padT-padB, n=axis.length;
var SER=[{k:'visitors',c:'#2563eb',name:'Besucher'},{k:'organic',c:'#16a34a',name:'Organische Klicks'},{k:'affClicks',c:'#f59e0b',name:'Affiliate-Klicks'}];
var fmtInt=function(v){return new Intl.NumberFormat('de-DE').format(Math.round(v));};
var fmtEur=function(v){return new Intl.NumberFormat('de-DE',{minimumFractionDigits:2,maximumFractionDigits:2}).format(v)+' €';};
function nice(m){ m=Math.max(1,m); var p=Math.pow(10,Math.max(0,String(Math.floor(m)).length-1)); return Math.ceil(m/p)*p; }
function el(t,a){ var e=document.createElementNS(SVGNS,t); for(var k in a)e.setAttribute(k,a[k]); return e; }
function esc(s){var d=document.createElement('div');d.textContent=s==null?'':String(s);return d.innerHTML;}
function dLabel(iso){var p=String(iso).split('-');return p[2]+'.'+p[1]+'.';}
var maxL=1,maxC=0;
SER.forEach(function(s){(D[s.k]||[]).forEach(function(v){if(v>maxL)maxL=v;});});
(D.commission||[]).forEach(function(v){if(v>maxC)maxC=v;});
var niceL=nice(maxL), niceC=nice(maxC);
var xStep=n>1?plotW/(n-1):plotW;
var xAt=function(i){return n<=1?padL+plotW/2:padL+plotW*i/(n-1);};
var yL=function(v){return padT+plotH*(1-v/niceL);};
var yC=function(v){return padT+plotH*(1-(niceC>0?v/niceC:0));};
var svg=el('svg',{viewBox:'0 0 '+W+' '+H,preserveAspectRatio:'none',role:'img','aria-label':'Performance-Verlauf'});
var grid=4;
for(var g=0;g<=grid;g++){
var gy=padT+plotH*g/grid;
svg.appendChild(el('line',{x1:padL,y1:gy.toFixed(1),x2:W-padR,y2:gy.toFixed(1),stroke:'#eceff3','stroke-width':1}));
var tl=el('text',{x:padL-6,y:(gy+3).toFixed(1),'text-anchor':'end','font-size':10,fill:'#94a3b8'}); tl.textContent=fmtInt(niceL*(1-g/grid)); svg.appendChild(tl);
if(niceC>0){ var tr=el('text',{x:W-padR+6,y:(gy+3).toFixed(1),'text-anchor':'start','font-size':10,fill:'#a78bfa'}); tr.textContent=Math.round(niceC*(1-g/grid)); svg.appendChild(tr); }
}
for(var i=0;i<n;i++){ if(n<=16||i%5===0||i===n-1){ var tx=el('text',{x:xAt(i).toFixed(1),y:H-7,'text-anchor':'middle','font-size':9,fill:'#94a3b8'}); tx.textContent=dLabel(axis[i]); svg.appendChild(tx); } }
// Balken Provision (rechte Achse)
var bw=Math.max(2,Math.min(16,xStep*0.55));
(D.commission||[]).forEach(function(v,i){ if(v<=0)return; var h=padT+plotH-yC(v); svg.appendChild(el('rect',{x:(xAt(i)-bw/2).toFixed(1),y:yC(v).toFixed(1),width:bw.toFixed(1),height:Math.max(0,h).toFixed(1),rx:2,fill:'#a78bfa','fill-opacity':.55})); });
// Linien
SER.forEach(function(s){ var pts=[]; (D[s.k]||[]).forEach(function(v,i){pts.push(xAt(i).toFixed(1)+','+yL(v).toFixed(1));}); svg.appendChild(el('polyline',{points:pts.join(' '),fill:'none',stroke:s.c,'stroke-width':2,'stroke-linejoin':'round','stroke-linecap':'round'})); });
// Hover
var guide=el('line',{x1:0,y1:padT,x2:0,y2:padT+plotH,stroke:'#cbd5e1','stroke-width':1,opacity:0}); svg.appendChild(guide);
var dots=SER.map(function(s){var c=el('circle',{r:3.5,fill:s.c,stroke:'#fff','stroke-width':1.5,opacity:0});svg.appendChild(c);return c;});
var hit=el('rect',{x:padL,y:padT,width:plotW,height:plotH,fill:'transparent'}); svg.appendChild(hit);
var tip=document.createElement('div'); tip.className='pdash-tip'; document.body.appendChild(tip);
function move(ev){
var box=svg.getBoundingClientRect(), rx=(ev.clientX-box.left)/box.width*W;
var i=Math.round((rx-padL)/(n>1?plotW/(n-1):1)); if(i<0)i=0; if(i>n-1)i=n-1;
var gx=xAt(i); guide.setAttribute('x1',gx); guide.setAttribute('x2',gx); guide.setAttribute('opacity',1);
var rows='';
SER.forEach(function(s,si){ var v=(D[s.k]||[])[i]||0; dots[si].setAttribute('cx',gx); dots[si].setAttribute('cy',yL(v)); dots[si].setAttribute('opacity',1);
rows+='<div><span style="display:inline-block;width:8px;height:8px;border-radius:2px;background:'+s.c+';margin-right:5px"></span>'+esc(s.name)+': <b>'+fmtInt(v)+'</b></div>'; });
var cv=(D.commission||[])[i]||0;
rows+='<div><span style="display:inline-block;width:8px;height:8px;border-radius:2px;background:#a78bfa;margin-right:5px"></span>Provision: <b>'+fmtEur(cv)+'</b></div>';
tip.innerHTML='<div style="opacity:.7;margin-bottom:3px">'+dLabel(axis[i])+'</div>'+rows; tip.style.opacity=1;
var tx=ev.clientX+14, ty=ev.clientY+14; if(tx+tip.offsetWidth>window.innerWidth-10)tx=ev.clientX-tip.offsetWidth-14;
tip.style.left=tx+'px'; tip.style.top=ty+'px';
}
function leave(){ guide.setAttribute('opacity',0); dots.forEach(function(d){d.setAttribute('opacity',0);}); tip.style.opacity=0; }
hit.addEventListener('mousemove',move); hit.addEventListener('mouseleave',leave);
host.appendChild(svg);
})();
})();