This commit is contained in:
rossmill76 committed 2026-03-23 15:05:57 +00:00
1 parent 2bfe914c8f
commit 4281924ee5
16 files changed
+369 -76

No files matched your search

+22
View File
@@ -90,6 +90,14 @@ window.chartInterop = {
const storedLabels = this.transactionLabels[canvasId];
const salaryIndices = salaryDayIndices || [];
const allVals = datasets.flatMap(ds => ds.data);
const yMin = allVals.length ? Math.min(...allVals) : 0;
const yMax = allVals.length ? Math.max(...allVals) : 0;
const yRange = yMax - yMin;
const yPad = yRange > 0 ? yRange * 0.15 : (Math.abs(yMin) * 0.15 || 100);
const ySuggestedMin = yMin - yPad;
const ySuggestedMax = yMax + yPad;
// Salary payday highlight plugin — subtle green band + 💰 marker
const salaryPlugin = {
id: 'salaryDays',
@@ -158,6 +166,8 @@ window.chartInterop = {
}
},
y: {
suggestedMin: ySuggestedMin,
suggestedMax: ySuggestedMax,
ticks: {
callback: function (value) {
return sym + value.toFixed(0);
@@ -306,3 +316,15 @@ document.addEventListener('focusin', function (e) {
e.target.select();
}
});
window.downloadCsv = function (filename, content) {
const blob = new Blob([content], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = filename;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(url);
};