javascript - Change display according to an option selected on top of a columnJQchart -
i need 3 radio button fields displaying yearly , monthly , weekly info on column chart when select either of alternative display should accordingly. found lot of examples in jqchart different types of displays couldn't find illustration this. there other alternative replacing radio button here? please help
your best bet have 3 series of data, 1 time each. can swap out series using listener on radio buttons.
essentially:
<input type="radio" name="data" id="yearly" class="radioselector" value="yearly">yearly<br> <input type="radio" name="data" id="monthly" class="radioselector" value="monthly">monthly<br> <input type="radio" name="data" id="daily" class="radioselector" value="daily">daily <script> $('.radioselector').click(function (event) { // set target id var id = $(event.target).attr('id'); // current series var series = $('#jqchart').jqchart('option', 'series'); // check radio switch (id) { case 'yearly': series = yearlydata; break; case 'monthly': series = monthlydata; break; case 'daily': series = dailydata; break; } // update (redraw) chart $('#jqchart').jqchart('update'); }); </script>
javascript jquery html5 jqchart
No comments:
Post a Comment