Luis Luis - 1 year ago 85
jQuery Question

BarChart does not fit on chart area

By using the code below, the X axis maximum value is only

and that hides the partly the
value, Is there any option to fix this axis rendering behavior?

var s1 = ["84486", "74987", "120249"];
var ticks = ['Length', 'Width', 'Height'];

$.jqplot('revi_chart', [s1], {
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
pointLabels: { show: true, location: 'w'},
rendererOptions: { barDirection: 'horizontal'},
axes: {
xaxis: { tickOptions: { showLabel: true, showGridline: false}},
yaxis: { renderer: $.jqplot.CategoryAxisRenderer, ticks: ticks,
tickOptions: { showGridline: false }}
highlighter: { show: false}

Here is the Fiddle:

Answer Source

Make s1 an array of numbers. It expects numbers on the X axis. Change the code from:

var s1 = ["84486", "74987", "120249"];


var s1 = [84486, 74987, 120249];

see the working version at:

This way X axis will always be automatically setting the maximum value.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download