var control = $('#control').bendGauge(); $('a').click(function (e) { e.preventDefault(); }); $('.set').click(function () { var result = []; for (var i = 0; i < 10; i++) { var chosenValue = Math.random() < 0.5; if (chosenValue) { result.push(i); } } control.bendGauge('set', result); }); $('.setMatrix').click(function () { var result = []; for (var i = 0; i < 10; i++) { var chosenValue = Math.random() < 0.5; result.push(chosenValue); } control.bendGauge('setMatrix', result); });
<div id="control"></div> <a href="#" class="set">set some random bends using <strong>set</strong></a> :: <a href="#" class="setMatrix">set some random bends using <strong>setMatrix</strong></a>
body { background: #333; } a { color:#FFF } #control { width: 200px; height: 200px; }