</> ConvertAtlas Developer Tools
Bootstrap 5 · Advanced

Live Feature Voting

Vote buttons that update a live horizontal bar chart, 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:380px;max-width:100%"><div class="card-body">
  <h6 class="fw-bold mb-2">Vote for a feature</h6>
  <div class="d-grid gap-2 mb-2" id="vcBtns"><button class="btn btn-outline-primary btn-sm" data-i="0">Dark mode</button><button class="btn btn-outline-primary btn-sm" data-i="1">Mobile app</button><button class="btn btn-outline-primary btn-sm" data-i="2">API access</button></div>
  <div id="vcChart"></div>
</div></div>
var votes=[12,8,5],chart=new ApexCharts(document.getElementById('vcChart'),{chart:{type:'bar',height:140,toolbar:{show:false}},series:[{data:votes}],colors:['#0d6efd'],plotOptions:{bar:{horizontal:true,borderRadius:4,barHeight:'50%'}},dataLabels:{enabled:true},xaxis:{categories:['Dark mode','Mobile app','API access']}});
chart.render();
document.querySelectorAll('#vcBtns [data-i]').forEach(function(b){b.onclick=function(){votes[+b.dataset.i]++;chart.updateSeries([{data:votes}])}});
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.