Reputation: 1077
I have the below graph and I want to add space between legend items. I have tried appending spaces to the string passed to the label with no success. Any ideas? TIA
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
Upvotes: 2
Views: 2396
Reputation: 108567
@Ryley's answer is good. If you want a little more control over each label you can put HTML mark-up in the label itself:
label: '<span style="padding-right:60px;">foo</span>'
Upvotes: 1
Reputation: 21226
The legend labels are in containers with the class legendLabel
, so you just have to define CSS for what you want. Put this in your page <head>
tag:
<style>
#chartLegend .legendLabel { padding-right:10px; }
</style>
This is what it would look like: http://jsfiddle.net/ryleyb/SZUuV/1/
Upvotes: 5
Reputation: 67115
Could you provide a snippet of your code? It looks to me like this might be the solution that you need. Use the labelFormatter to force the setup the way that you need it.
Upvotes: 0