Javascript 如何避免jqplot中的记号与图例重叠
我使用jqplot,我的绘图记号与我的图例重叠,如下所示 我需要把图例移到刻度下面。 我的密码是Javascript 如何避免jqplot中的记号与图例重叠,javascript,jquery,jqplot,Javascript,Jquery,Jqplot,我使用jqplot,我的绘图记号与我的图例重叠,如下所示 我需要把图例移到刻度下面。 我的密码是 var plot3 = $.jqplot('chartdiv', [], { animate: true, animateReplot: true, axes:{ xaxis:{ renderer:$.jqplot.DateAxisRenderer, tickRenderer: $.jqplot.CanvasAxisTickRenderer,
var plot3 = $.jqplot('chartdiv', [], {
animate: true,
animateReplot: true,
axes:{
xaxis:{
renderer:$.jqplot.DateAxisRenderer,
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
tickOptions:{
formatString:'%b',
angle: -90
},
tickInterval:'1 month'
},
yaxis:{
label:'',
labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
tickOptions: {
angle: 15
},
}
},
legend:{
show:true,
renderer: $.jqplot.EnhancedLegendRenderer,
location: 's' ,
placement : "outside",
rendererOptions: {
numberRows: 1
}
},
series:[{lineWidth:4, markerOptions:{style:'square'}}],
dataRenderer: sineRenderer
});
有办法吗?谢谢。您可以使用图例渲染器的
marginTop
属性,如中所述
指定偏移量
这是一个基于你问题中代码的示例。正如您在屏幕截图中看到的,图例放置在轴标签下方
这里是可编辑版本的链接非常感谢您的回答。但正如我在他们的文档中看到的,xoffset-yoffset属性已被弃用。因此,他们建议使用marginTop、marginBottom、marginRight、marginLeft属性。我试过了,但没用。你能告诉我如何使用这些来移动我的图例框吗?@DilanG嘿,谢谢你提供的信息。我更新了答案和小提琴。您必须将其指定为CSS参数,例如
marginTop:“50px”
非常感谢。现在没关系了,我的问题是我没有用“px”作为保证金上限。再次感谢您的帮助。@DilanG不客气:)是的,我只是猜到了。不幸的是,jqPlots文档有时没有那么大的帮助
legend: {
marginTop: "50px"
}