Chart with Date Filter
A sales area chart paired with a Flatpickr date-range filter.
Requires Bootstrap 5, ApexCharts, Flatpickr. 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"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/flatpickr.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><script src="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13"></script><div class="card border-0 shadow-sm" style="width:420px;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">Sales</h6><input class="form-control form-control-sm" id="dfRange" style="width:160px" placeholder="Date range"></div>
<div id="dfChart"></div>
</div></div>new ApexCharts(document.getElementById('dfChart'),{chart:{type:'area',height:180,toolbar:{show:false}},series:[{name:'Sales',data:[20,35,30,45,55,48,60]}],colors:['#16a34a'],fill:{type:'gradient',gradient:{opacityFrom:.5,opacityTo:0}},stroke:{curve:'smooth',width:2},dataLabels:{enabled:false}}).render();
flatpickr('#dfRange',{mode:'range',dateFormat:'M j'});Free to use.This component uses Bootstrap 5, ApexCharts, Flatpickr (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.