我知道这个问题有点重复
但是由于该问题没有得到确认的答案(发布的问题对我不起作用),所以我在这里重新提出。
我有一个从 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, },
... ...
}