diff options
author | William Carroll <wpcarro@gmail.com> | 2023-01-23T15·51-0800 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-01-23T15·59+0000 |
commit | 274610f1d3a0263b058ae4327af0445ca34f27d6 (patch) | |
tree | 03b7830adbda48be7307a7ca32b119cc900877ee /users/wpcarro/ynabsql/dataviz/chart.js | |
parent | b3a91ce57b2b55fe0ad246425f6528caef11a1e7 (diff) |
chore(wpcarro/ynabsql): Delete stale files r/5742
This also removes the globally available `data.data.transactions`. Change-Id: I674a772ac91f01ff8c2d211157bd567391ab1765 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7913 Autosubmit: wpcarro <wpcarro@gmail.com> Tested-by: BuildkiteCI Reviewed-by: wpcarro <wpcarro@gmail.com>
Diffstat (limited to 'users/wpcarro/ynabsql/dataviz/chart.js')
-rw-r--r-- | users/wpcarro/ynabsql/dataviz/chart.js | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/users/wpcarro/ynabsql/dataviz/chart.js b/users/wpcarro/ynabsql/dataviz/chart.js deleted file mode 100644 index 7ec8f00aae06..000000000000 --- a/users/wpcarro/ynabsql/dataviz/chart.js +++ /dev/null @@ -1,66 +0,0 @@ -const colors = { - red: 'rgb(255, 45, 70)', - green: 'rgb(75, 192, 35)', -}; - -//////////////////////////////////////////////////////////////////////////////// -// Main -//////////////////////////////////////////////////////////////////////////////// - -const mount = document.getElementById('mount'); - -const chart = new Chart(mount, { - type: 'scatter', - data: { - datasets: [ - { - label: 'Revenue', - data: data.data.transactions.filter(x => x.Inflow > 0).map(x => ({ - x: x.Date, - y: x.Inflow, - metadata: x, - })), - backgroundColor: colors.green, - }, - { - label: 'Expenses', - data: data.data.transactions.filter(x => x.Outflow).map(x => ({ - x: x.Date, - y: x.Outflow, - metadata: x, - })), - backgroundColor: colors.red, - }, - ], - }, - options: { - scales: { - x: { - type: 'time', - title: { - display: true, - text: 'Date', - }, - }, - y: { - title: { - display: true, - text: 'Amount ($USD)' - }, - }, - }, - plugins: { - tooltip: { - callbacks: { - title: function(x) { - return `$${x[0].raw.y} (${x[0].raw.metadata.Date.toLocaleDateString()})`; - }, - label: function(x) { - const { Category, Payee, Memo } = x.raw.metadata; - return `${Payee} - ${Category} (${Memo})`; - }, - }, - }, - }, - }, -}); |