Building on the Quick Start example, you can get the number of bars in your chart. Here, we only write the number out to the console log, but you can use it for any purpose you like.
Drop down and copy code
Get Number of Bars Script |
Copy Code |
---|---|
<script id="scriptInit" type="text/javascript"> $(document).ready(function () { $("#wijbarchart").wijbarchart({ chartLabelFormatString: "p0", seriesList: [{ label: "2012 Auto Sales", legendEntry: true, data: { x: ['Ford', 'GM', 'Chrysler', 'Toyota', 'Nissan', 'Honda'], y: [.05, .04, .21, .27, .1, .24] } }], }); var len = $("#wijbarchart").data().fields.chartElements.bars.length; console.log(len); }); </script> |