我知道这个问题有点重复
jqPlot Styling - How to remove Y axis line?
但由于那个问题没有得到确认的答案(发布的那个对我不起作用),所以我在这里重新提问。
我有一个简单的示例从jqPlot网页复制到条形图示例,并且想要删除y轴线而不将其更改为$ .jqplot.CategoryAxisRenderer(可以隐藏轴线作为我的x轴)。
http://jsfiddle.net/marsant/HndmB/3/
代码:
$(document).ready(function(){
var s1 = [200, 600, 700, 1000, 600];
// Can specify a custom tick Array.
// Ticks should match up one for each y value (category) in the series.
var ticks = ['May', 'June', 'July', 'August', 'September'];
var plot1 = $.jqplot('chart1', [s1], {
// The "seriesDefaults" option is an options object that will
// be applied to all series in the chart.
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
rendererOptions: { barWidth: 20 },
color:'blue',
shadow: false,
},
grid: {
drawBorder: false,
shadow: false,
},
axes: {
// Use a category axis on the x axis and use our custom ticks.
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
ticks: ticks,
tickOptions: { showGridline: false, showMark: false },
showTickMarks: false,
},
// Pad the y axis just a little so bars can get close to, but
// not touch, the grid boundaries. 1.2 is the default padding.
yaxis: {
pad: 1.05,
tickOptions: { formatString: '$%d', showMark: false },
showTickMarks: false,
}
}
});
});
更新:
此代码示例适用于我
yaxis: {
renderer: $.jqplot.LinearAxisRenderer,
rendererOptions: { drawBaseline: false, },
... ...
}
答案 0 :(得分:5)
您可以在网格选项之后和轴选项之前尝试插入:
axesDefaults: {
rendererOptions: {
drawBaseline: false
}
},
希望它有所帮助。