SHARE
TWEET

Untitled

a guest Oct 19th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!doctype html>
  2. <html lang="en">
  3.   <head>
  4.     <canvas id="myChart" </>
  5.  
  6.     <meta charset="utf-8">
  7.     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  8.  
  9.     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  10.     <link rel="stylesheet" href="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.css">
  11.  
  12.     <title>Chart</title>
  13.   </head>
  14.   <body>
  15.  
  16.       <div class="container my-chart">
  17.  
  18.       </div>
  19.  
  20.     <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
  21.     <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
  22.     <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
  23.     <script src="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.js"></script>
  24.     <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.js"></script>
  25.  
  26.  
  27.     <script>
  28.     $(document).ready(function() {
  29.     $('#chart-form').on('submit', function(event) {
  30.         $.ajax({
  31.             data: {selectField: $('#selectField').val()},
  32.             type: 'POST',
  33.             url: '/process',
  34.             success: function(result) {
  35.                 console.log(result)
  36.             }
  37.         });
  38.         event.preventDefault();
  39.     });
  40. });
  41.  
  42. var myBarChart = new Chart($("#myChart"), {
  43.                 type: 'bar',
  44.                 data: {
  45.                     datasets: [{
  46.                         label: 'My very cool number',
  47.                         data: [1],
  48.                         backgroundColor: ['rgba(255, 99, 132, 0.2)']
  49.                     }]
  50.                 },
  51.                 options: {
  52.                     responsive: false,
  53.                     scales: {
  54.                         yAxes: [{
  55.                             ticks: {
  56.                                 beginAtZero: true
  57.                             }
  58.                         }]
  59.                     }
  60.                 }
  61.             });
  62.         </script>
  63.  
  64. </div>
  65.  
  66. <form id="chart-form" class="form-group">
  67.     <label for="exampleFormControlSelect1">Example select</label>
  68.     <select class="form-control" id="selectField">
  69.       <option>1</option>
  70.       <option>30</option>
  71.       <option>3</option>
  72.       <option>20</option>
  73.       <option>5</option>
  74.     </select>
  75.     <button type="submit" class="btn btn-primary">Submit</button>
  76. </form>
  77.  
  78.  
  79. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top