diff options
author | Calvin Morrison <calvin@fastmailteam.com> | 2022-08-02 18:38:01 -0400 |
---|---|---|
committer | Calvin Morrison <calvin@fastmailteam.com> | 2022-08-02 18:38:01 -0400 |
commit | 0d2180d9b488219e570d354d11ec3782f1b46024 (patch) | |
tree | 53aae2ff3b7b2d90878748d1887c87d67d26ad85 /storage/framework | |
parent | f2aff7518be55da0fd250e04a4bfc1bbbd5a3d0a (diff) |
add a chart
Diffstat (limited to 'storage/framework')
8 files changed, 66 insertions, 4 deletions
diff --git a/storage/framework/cache/data/c0/71/c071422490d526a8aada046adf3a9c9fa0593468 b/storage/framework/cache/data/c0/71/c071422490d526a8aada046adf3a9c9fa0593468 new file mode 100644 index 0000000..61623dc --- /dev/null +++ b/storage/framework/cache/data/c0/71/c071422490d526a8aada046adf3a9c9fa0593468 @@ -0,0 +1 @@ +1659479923i:1;
\ No newline at end of file diff --git a/storage/framework/cache/data/ec/c4/ecc49f49f4da6b940dcde13f0571e79c299871e6 b/storage/framework/cache/data/ec/c4/ecc49f49f4da6b940dcde13f0571e79c299871e6 new file mode 100644 index 0000000..62d67bc --- /dev/null +++ b/storage/framework/cache/data/ec/c4/ecc49f49f4da6b940dcde13f0571e79c299871e6 @@ -0,0 +1 @@ +1659479923i:1659479923;
\ No newline at end of file diff --git a/storage/framework/sessions/IbjsErLYQzv6zdAkloOohNWOfA7kCEVvR0RFjvzb b/storage/framework/sessions/IbjsErLYQzv6zdAkloOohNWOfA7kCEVvR0RFjvzb new file mode 100644 index 0000000..4212e04 --- /dev/null +++ b/storage/framework/sessions/IbjsErLYQzv6zdAkloOohNWOfA7kCEVvR0RFjvzb @@ -0,0 +1 @@ +a:3:{s:6:"_token";s:40:"YB94FUdKBJOvUxF0jADGyvwQqVhu68jWs6plg5SZ";s:9:"_previous";a:1:{s:3:"url";s:21:"http://localhost:8000";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}
\ No newline at end of file diff --git a/storage/framework/sessions/ZNKjy5Pf6yaDyX9qmYuB4bqDOTWReGznWoM3jZZ8 b/storage/framework/sessions/ZNKjy5Pf6yaDyX9qmYuB4bqDOTWReGznWoM3jZZ8 new file mode 100644 index 0000000..29708b3 --- /dev/null +++ b/storage/framework/sessions/ZNKjy5Pf6yaDyX9qmYuB4bqDOTWReGznWoM3jZZ8 @@ -0,0 +1 @@ +a:3:{s:6:"_token";s:40:"l1Qg11j9acN71xEZyPAGJoDZTUSNSA3A3WyzMvyg";s:9:"_previous";a:1:{s:3:"url";s:21:"http://localhost:8000";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}
\ No newline at end of file diff --git a/storage/framework/sessions/acN2Elwg4qkGZVjvY6K1SRa546OqFOhZNvfWQdz1 b/storage/framework/sessions/acN2Elwg4qkGZVjvY6K1SRa546OqFOhZNvfWQdz1 new file mode 100644 index 0000000..704a7eb --- /dev/null +++ b/storage/framework/sessions/acN2Elwg4qkGZVjvY6K1SRa546OqFOhZNvfWQdz1 @@ -0,0 +1 @@ +a:3:{s:6:"_token";s:40:"FgTtuqjEL2fjDmQNMWSmi6I2axdPKyx9ZVYnt5fZ";s:9:"_previous";a:1:{s:3:"url";s:21:"http://localhost:8000";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}
\ No newline at end of file diff --git a/storage/framework/sessions/bD0Om2KDolUqqR3vfJOw0w2Mt0wpPDgfeJVD7Bzy b/storage/framework/sessions/bD0Om2KDolUqqR3vfJOw0w2Mt0wpPDgfeJVD7Bzy deleted file mode 100644 index 30261b6..0000000 --- a/storage/framework/sessions/bD0Om2KDolUqqR3vfJOw0w2Mt0wpPDgfeJVD7Bzy +++ /dev/null @@ -1 +0,0 @@ -a:3:{s:6:"_token";s:40:"Sb5MBBwnnUqkhRaYmbUB8wQKjTlzP4DbiMoLuKEN";s:9:"_previous";a:1:{s:3:"url";s:21:"http://localhost:8000";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}
\ No newline at end of file diff --git a/storage/framework/sessions/pKRRA7YS5oz0psgR7h2L3L7FOeSr9jJtETK2iND8 b/storage/framework/sessions/pKRRA7YS5oz0psgR7h2L3L7FOeSr9jJtETK2iND8 new file mode 100644 index 0000000..bf82541 --- /dev/null +++ b/storage/framework/sessions/pKRRA7YS5oz0psgR7h2L3L7FOeSr9jJtETK2iND8 @@ -0,0 +1 @@ +a:3:{s:6:"_token";s:40:"HMEZCb9I8qVTGHDZBEUJdaU7meSQ7NbtvjjMFR9z";s:9:"_previous";a:1:{s:3:"url";s:21:"http://localhost:8000";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}
\ No newline at end of file diff --git a/storage/framework/views/012a1d662de1d6e091232755fc22d6187f7576fe.php b/storage/framework/views/012a1d662de1d6e091232755fc22d6187f7576fe.php index fb7adbf..ec29da8 100644 --- a/storage/framework/views/012a1d662de1d6e091232755fc22d6187f7576fe.php +++ b/storage/framework/views/012a1d662de1d6e091232755fc22d6187f7576fe.php @@ -6,6 +6,10 @@ <title>Bitcoin Price References</title> + <!-- external scripts --> + <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.js" charset="utf-8"></script> + <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> + <!-- Fonts --> <link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet"> @@ -29,18 +33,72 @@ <div class="mt-8 bg-white dark:bg-gray-800 overflow-hidden shadow sm:rounded-lg"> <div class="grid grid-cols-1 md:grid-cols-2"> - <div class="p-6"> + <div class="p-3"> <div class="ml-2"> <div class="mt-2 text-gray-600 dark:text-gray-400 text-sm"> Last Update: <?php echo e($rates[0]->updated_at); ?><br> Current price reference: </div> + <div> + <select id="currency"> + <?php $__currentLoopData = $rates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rate): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> + <option value="<?php echo e($rate->currency->name); ?>"><?php echo e($rate->currency->name); ?></option> + <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> + </select> + + <canvas id="Chart" height="600" width="800"></canvas> + <script type="application/javascript"> + $(document).ready(function() { + UpdateChart(); + }); + + $('select#currency').on('change', function() { + UpdateChart(); + }); + + function UpdateChart() { + currency = $('select#currency')[0].value; + + $.ajax({url: "api/rateseries/" + currency, success: function(result){ + BuildChart($('select#currency')[0].value + " to BTC", result); + }}); + } + + function BuildChart(label, data) { + if(typeof myChart !== 'undefined') { + myChart.destroy(); + } + const config = { + type: 'line', + label: 'test 1', + data: { + labels: data.map(x => new Date(x.x * 1000).toISOString().slice(0, 19).replace('T', ' ')), + datasets: [ + { label: label, data: data, }] + }, + options: { + scales: { + x: { + type: 'time', + } + } + } + }; + myChart = new Chart( + document.getElementById('Chart'), + config); + } + </script> + + + + + </div> <table class="text-gray-600 dark:text-gray-400 table"> <thead> <th>Name</th> <th>Unit</th> - <th>Description</th> <th>Last Rate (to BTC)</th> </thead> <tbody> @@ -48,7 +106,6 @@ <tr> <td><?php echo e($rate->currency->name); ?></td> <td><?php echo e($rate->currency->unit); ?></td> - <td><?php echo e($rate->currency->description); ?></td> <td><?php echo e($rate->value); ?></td> </tr> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> |