Reputation: 89
I'm using d3 and nvd3 to visualize some data in a graph. Now, no matter how many graphs i have, the legend above the (line)graph will always be shortened with trailing dots at the end.
Is there a way to adjust the legend in a fairly comfortable way? If so, how would i adress the legend and its properties?
Upvotes: 0
Views: 1048
Reputation: 389
legend: {
maxKeyLength: 100,
padding: 40
}
This will set maximum text length of legend as 100 and ensures text cut off due to ellipsis.
Upvotes: 1
Reputation: 41
Thanks Reteras it did the trick for my PieChart, here are my legend chart options (typescript version)
Just change the margin to adjust the position
legend: {
align: false,
height: 200,
margin: {
right: 50,
top: 25,
left:0
}
}
legendPosition: 'right',
Upvotes: 2
Reputation: 89
I found the answer myself.
To keep the text from shortening, you can use chart.legend.align(false)
Upvotes: 2