From 3dd773e22913ae957ed51529a3333ae8630a3cc7 Mon Sep 17 00:00:00 2001
From: jackstar12 <jkranawetter05@gmail.com>
Date: Wed, 21 Jun 2023 22:37:57 +0200
Subject: [PATCH] include count in chart

---
 lnbits/static/js/base.js | 41 ++++++++++++++++++++++++++++++++++++----
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/lnbits/static/js/base.js b/lnbits/static/js/base.js
index 310026ef5..c5d622003 100644
--- a/lnbits/static/js/base.js
+++ b/lnbits/static/js/base.js
@@ -345,13 +345,15 @@ window.LNbits = {
           previous.income.push(current.income)
           previous.spending.push(current.spending)
           previous.cumulative.push(current.balance)
+          previous.count.push(current.count)
           return previous
         },
         {
           labels: [],
           income: [],
           spending: [],
-          cumulative: []
+          cumulative: [],
+          count: []
         }
       )
 
@@ -368,7 +370,8 @@ window.LNbits = {
               borderColor: '#673ab7',
               borderWidth: 4,
               pointRadius: 3,
-              fill: false
+              fill: false,
+              yAxisID: 'balance'
             },
             {
               data: data.income,
@@ -378,7 +381,8 @@ window.LNbits = {
               backgroundColor: window
                 .Color('rgb(76,175,80)')
                 .alpha(0.5)
-                .rgbString() // green
+                .rgbString(), // green
+              yAxisID: 'balance'
             },
             {
               data: data.spending,
@@ -388,7 +392,19 @@ window.LNbits = {
               backgroundColor: window
                 .Color('rgb(233,30,99)')
                 .alpha(0.5)
-                .rgbString() // pink
+                .rgbString(), // pink
+              yAxisID: 'balance'
+            },
+            {
+              data: data.count,
+              type: 'bar',
+              label: 'count',
+              barPercentage: 0.75,
+              backgroundColor: window
+                .Color('rgb(33,30,209)')
+                .alpha(0.5)
+                .rgbString(), // blue
+              yAxisID: 'count'
             }
           ]
         },
@@ -411,6 +427,23 @@ window.LNbits = {
                   stepSize: 3
                 }
               }
+            ],
+            yAxes: [
+              {
+                id: 'balance',
+                type: 'linear',
+                position: 'left'
+              },
+              {
+                id: 'changes',
+                type: 'linear',
+                position: 'right'
+              },
+              {
+                id: 'count',
+                type: 'linear',
+                position: 'right'
+              }
             ]
           },
           // performance tweaks