Database-Abstraction
view release on metacpan or search on metacpan
scripts/generate_index.pl view on Meta::CPAN
for (const name of candidates) {
if (window[name]) {
try { Chart.register(window[name]); console.log('Registered zoom plugin:', name); return; } catch(e) { console.warn('zoom register failed for', name, e); }
}
}
// Some CDN builds auto-register the plugin; if nothing found that's OK (feature disabled).
} catch(e) {
console.warn('registerZoomPlugin error', e);
}
})();
const ctx = document.getElementById('coverageTrend').getContext('2d');
const chart = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
label: 'Total Coverage (%)',
data: dataPoints,
borderColor: 'green',
backgroundColor: 'rgba(0,128,0,0.1)',
pointRadius: 5,
pointHoverRadius: 7,
pointStyle: 'circle',
fill: false,
tension: 0.3,
pointBackgroundColor: function(context) {
return context.raw.pointBackgroundColor || 'gray';
}
}, {
label: 'Regression Line',
data: regressionPoints,
borderColor: 'blue',
borderDash: [5, 5],
pointRadius: 0,
fill: false,
tension: 0.0
}]
}, options: {
scales: {
x: {
type: 'time',
time: {
tooltipFormat: 'MMM d, yyyy HH:mm:ss',
unit: 'day'
},
title: { display: true, text: 'Commit Date' }
},
y: { beginAtZero: true, max: 100, title: { display: true, text: 'Coverage (%)' } }
}, plugins: {
legend: {
display: true,
position: 'top', // You can also use 'bottom', 'left', or 'right'
labels: {
boxWidth: 12,
padding: 10,
font: {
size: 12,
weight: 'bold'
}
}
}, tooltip: {
callbacks: {
label: function(context) {
const raw = context.raw;
const coverage = raw.y.toFixed(1);
const delta = raw.delta?.toFixed(1) ?? '0.0';
const sign = delta > 0 ? '+' : delta < 0 ? '-' : '±';
// const baseLine = `${raw.label}: ${coverage}% (${sign}${Math.abs(delta)}%)`;
const baseLine = `${coverage}% (${sign}${Math.abs(delta)}%)`;
const commentLine = raw.comment ? raw.comment : null;
return commentLine ? [baseLine, commentLine] : [baseLine];
}
}
} , zoom: { // Enable zoom & pan on the x-axis for the trend chart
pan: {
enabled: true,
mode: 'x'
}, zoom: {
wheel: {
enabled: true
}, pinch: {
enabled: true
}, mode: 'x'
}
}
}, onClick: (e) => {
const points = chart.getElementsAtEventForMode(e, 'nearest', { intersect: true }, true);
if (points.length) {
const url = chart.data.datasets[0].data[points[0].index].url;
window.open(url, '_blank');
}
}
}
});
document.getElementById('toggleTrend').addEventListener('change', function(e) {
const show = e.target.checked;
const trendDataset = chart.data.datasets.find(ds => ds.label === 'Regression Line');
trendDataset.hidden = !show;
chart.update();
});
// Reset Zoom button handler (calls plugin API if available)
const resetBtn = document.getElementById('resetZoomBtn');
if (resetBtn) {
resetBtn.addEventListener('click', function() {
try {
if (chart && typeof chart.resetZoom === 'function') {
chart.resetZoom();
} else {
console.warn('resetZoom not available; zoom plugin may not be registered.');
}
} catch (e) {
console.warn('resetZoom call failed', e);
}
});
}
function sortTable(n) {
const table = document.querySelector("table");
if (!table || !table.tBodies || !table.tBodies[0]) return;
( run in 2.581 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )