Building on the Quick Start example, you can rotate the labels that appear on each bar in the chart using either of two methods. One uses the chartLabelStyle option, and the other accesses the chartLabels using the data fields chartElements collection.
To format the numeric values of these labels, use the chartLabelFormatString option. To hide them, use the showChartLabels option.
Drop down and copy code
Rotate Bar Labels Script |
Copy Code |
---|---|
<script id="scriptInit" type="text/javascript"> $(document).ready(function () { $("#wijbarchart").wijbarchart({ chartLabelStyle: {rotation: 90}, seriesList: [{ label: "2012 Auto Sales", legendEntry: true, data: { x: ['Ford', 'GM', 'Chrysler', 'Toyota', 'Nissan', 'Honda'], y: [.05, .04, .21, .27, .1, .24] } }], }); }); </script> |
Drop down and copy code
Rotate Bar Labels Script |
Copy Code |
---|---|
<script id="scriptInit" type="text/javascript"> $(document).ready(function () { $("#wijbarchart").wijbarchart({ seriesList: [{ label: "2012 Auto Sales", legendEntry: true, data: { x: ['Ford', 'GM', 'Chrysler', 'Toyota', 'Nissan', 'Honda'], y: [.05, .04, .21, .27, .1, .24] } }], }); var data = $("#wijbarchart").wijbarchart().data(); var labels = data.fields.chartElements.chartLabels; $.each(labels, function (key, value) { value.rotate("90 deg"); }); }); </script> |