Jquery 如何在FLOT中的图例项之间添加空格?
我有下图,我想在图例项之间添加空格。我尝试在传递给标签的字符串中添加空格,但没有成功。有什么想法吗?短暂性脑缺血发作Jquery 如何在FLOT中的图例项之间添加空格?,jquery,html,flot,Jquery,Html,Flot,我有下图,我想在图例项之间添加空格。我尝试在传递给标签的字符串中添加空格,但没有成功。有什么想法吗?短暂性脑缺血发作 code $(document).ready(function() { $.plot($("#NR"), NRLine, { grid: { backgroundColor: "#E5E5E5", hoverable: true
code
$(document).ready(function() {
$.plot($("#NR"), NRLine, {
grid: {
backgroundColor: "#E5E5E5",
hoverable: true
},
xaxis: {
mode: "time",
timeformat: "%m/%d",
minTickSize: [7, "day"],
ticks: datearray
},
legend: {
noColumns: 4,
container: $("#chartLegend")}
}
);
});
code
能否提供您的代码片段?在我看来,这可能是你需要的解决方案。使用labelFormatter强制按您需要的方式进行设置。图例标签位于带有类legendLabel
的容器中,因此您只需根据需要定义CSS即可。将其放入您的页面
标签:
$(document).ready(function() {
$.plot($("#NR"), NRLine, {
grid: {
backgroundColor: "#E5E5E5",
hoverable: true
},
xaxis: {
mode: "time",
timeformat: "%m/%d",
minTickSize: [7, "day"],
ticks: datearray
},
legend: {
noColumns: 4,
container: $("#chartLegend")}
}
);
});
<style>
#chartLegend .legendLabel { padding-right:10px; }
</style>
#chartLegend.legendLabel{padding right:10px;}
看起来是这样的:@Ryley的答案很好。如果您想对每个标签进行多一点控制,可以放置:
标签:“foo”
我不确定标签格式化程序如何实现这一点-您能提供一个间距示例吗?