Skip to content

Commit

Permalink
fix link in year-over-year chart
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasgerstmayr committed Nov 29, 2023
1 parent 1a48dfb commit 3d2cbdf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example/dashboards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ dashboards:
onClick: (event) => {
const link = panel.queries[0].link
.replaceAll("#", "%23")
.replace("{account}", event.name)
.replace("{account}", accounts[event.dataIndex])
.replace("{time}", event.seriesName);
window.open(link);
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/tests/e2e/__snapshots__/dashboards.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4111,7 +4111,7 @@ exports[`Dashboard: HTML Snapshot Tests Income and Expenses 1`] = `
]
}
],
"script": "const currencyFormat = new Intl.NumberFormat(undefined, {\\n style: \\"currency\\",\\n currency: ledger.ccy,\\n maximumFractionDigits: 0,\\n});\\nconst years = helpers.iterateYears(ledger.dateFirst, ledger.dateLast);\\nconst maxExpenseAccounts = 10; // number of expense accounts to show (sorted by biggest expenses)\\n\\nconst accountSums = {};\\nconst amounts = {};\\nfor (let row of panel.queries[0].result) {\\n if (!(row.account in accountSums)) accountSums[row.account] = 0;\\n amounts[\`\${row.year}/\${row.account}\`] = row.value[ledger.ccy];\\n accountSums[row.account] += row.value[ledger.ccy];\\n}\\n\\nconst accounts = Object.entries(accountSums)\\n .sort(([, a], [, b]) =\\u003e b - a)\\n .map(([name]) =\\u003e name)\\n .slice(0, maxExpenseAccounts)\\n .reverse();\\nreturn {\\n legend: {\\n top: \\"bottom\\",\\n },\\n xAxis: {\\n axisLabel: {\\n formatter: currencyFormat.format,\\n },\\n },\\n yAxis: {\\n data: accounts.map((account) =\\u003e account.split(\\":\\").pop()),\\n },\\n series: years.map((year) =\\u003e ({\\n type: \\"bar\\",\\n name: year,\\n data: accounts.map((account) =\\u003e amounts[\`\${year}/\${account}\`] ?? 0),\\n label: {\\n show: true,\\n position: \\"right\\",\\n formatter: (params) =\\u003e currencyFormat.format(params.value),\\n },\\n })),\\n onClick: (event) =\\u003e {\\n const link = panel.queries[0].link\\n .replaceAll(\\"#\\", \\"%23\\")\\n .replace(\\"{account}\\", event.name)\\n .replace(\\"{time}\\", event.seriesName);\\n window.open(link);\\n },\\n};\\n",
"script": "const currencyFormat = new Intl.NumberFormat(undefined, {\\n style: \\"currency\\",\\n currency: ledger.ccy,\\n maximumFractionDigits: 0,\\n});\\nconst years = helpers.iterateYears(ledger.dateFirst, ledger.dateLast);\\nconst maxExpenseAccounts = 10; // number of expense accounts to show (sorted by biggest expenses)\\n\\nconst accountSums = {};\\nconst amounts = {};\\nfor (let row of panel.queries[0].result) {\\n if (!(row.account in accountSums)) accountSums[row.account] = 0;\\n amounts[\`\${row.year}/\${row.account}\`] = row.value[ledger.ccy];\\n accountSums[row.account] += row.value[ledger.ccy];\\n}\\n\\nconst accounts = Object.entries(accountSums)\\n .sort(([, a], [, b]) =\\u003e b - a)\\n .map(([name]) =\\u003e name)\\n .slice(0, maxExpenseAccounts)\\n .reverse();\\nreturn {\\n legend: {\\n top: \\"bottom\\",\\n },\\n xAxis: {\\n axisLabel: {\\n formatter: currencyFormat.format,\\n },\\n },\\n yAxis: {\\n data: accounts.map((account) =\\u003e account.split(\\":\\").pop()),\\n },\\n series: years.map((year) =\\u003e ({\\n type: \\"bar\\",\\n name: year,\\n data: accounts.map((account) =\\u003e amounts[\`\${year}/\${account}\`] ?? 0),\\n label: {\\n show: true,\\n position: \\"right\\",\\n formatter: (params) =\\u003e currencyFormat.format(params.value),\\n },\\n })),\\n onClick: (event) =\\u003e {\\n const link = panel.queries[0].link\\n .replaceAll(\\"#\\", \\"%23\\")\\n .replace(\\"{account}\\", accounts[event.dataIndex])\\n .replace(\\"{time}\\", event.seriesName);\\n window.open(link);\\n },\\n};\\n",
"title": "Expenses Year-Over-Year \\ud83d\\udcb8",
"type": "echarts"
},
Expand Down

0 comments on commit 3d2cbdf

Please sign in to comment.