</> ConvertAtlas Developer Tools
Bootstrap 5 · Advanced

Analytics with Range Switch

A bar chart whose data updates when the date range changes, via ApexCharts.

Requires Bootstrap 5, ApexCharts. Add the CDN tags below to your page (styles in <head>, scripts before </body>). The downloaded file already includes them.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/apexcharts@3.49.1/dist/apexcharts.min.js"></script>
<div class="card border-0 shadow-sm" style="width:440px;max-width:100%"><div class="card-body">
  <div class="d-flex justify-content-between align-items-center mb-2"><h6 class="fw-bold mb-0">Analytics</h6><select id="anRange" class="form-select form-select-sm" style="width:auto"><option>7 days</option><option>30 days</option></select></div>
  <div id="anChart"></div>
</div></div>
var chart=new ApexCharts(document.getElementById('anChart'),{chart:{type:'bar',height:200,toolbar:{show:false}},series:[{name:'Visits',data:[44,55,41,67,22,43,50]}],colors:['#0d6efd'],plotOptions:{bar:{borderRadius:6,columnWidth:'55%'}},dataLabels:{enabled:false}});
chart.render();
document.getElementById('anRange').onchange=function(){var d=this.selectedIndex===0?[44,55,41,67,22,43,50]:[90,84,72,110,95,130,120,88,99,105];chart.updateSeries([{name:'Visits',data:d}])};
Free to use.This component uses Bootstrap 5, ApexCharts (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.