通过使用下面的代码,X轴最大值仅为85000
并且隐藏了部分120k
值,是否有任何选项可以修复此轴渲染行为?
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}
});
这是 fiddle : http://jsfiddle.net/frelis/x7Lyj5t6/12/
最佳答案
使 s1 成为一个数字数组。它期望 X 轴上的数字。 更改代码:
var s1 = ["84486", "74987", "120249"];
至
var s1 = [84486, 74987, 120249];
查看工作版本:http://jsfiddle.net/x7Lyj5t6/13/
这样X轴将始终自动设置最大值。
关于javascript - 条形图不适合图表区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39530643/