Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New legend position option: "inset" #326

Merged
merged 3 commits into from
Jun 9, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions c3.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@
}
// for legend
var insetLegendPosition = {
top: isLegendTop ? getCurrentPaddingTop() + __legend_inset_y + 5.5 : currentHeight - legendHeight - getCurrentPaddingBottom() - __legend_inset_y,
left: isLegendLeft ? getCurrentPaddingLeft() + __legend_inset_x + 0.5 : currentWidth - legendWidth - getCurrentPaddingRight() - __legend_inset_x + 0.5
top: isLegendTop ? getCurrentPaddingTop() + __legend_inset_y + 5.5 : currentHeight - legendHeight - getCurrentPaddingBottom() - __legend_inset_y,
left: isLegendLeft ? getCurrentPaddingLeft() + __legend_inset_x + 0.5 : currentWidth - legendWidth - getCurrentPaddingRight() - __legend_inset_x + 0.5
};
margin3 = {
top: isLegendRight ? 0 : isLegendInset ? insetLegendPosition.top : currentHeight - legendHeight,
Expand Down Expand Up @@ -4660,14 +4660,14 @@
.attr('width', 10)
.attr('height', 10);
// Set background for inset legend
if (isLegendInset && maxWidth != 0) {
legend.insert('g', '.' + CLASS.legendItem)
if (isLegendInset && maxWidth !== 0) {
legend.insert('g', '.' + CLASS.legendItem)
.attr("class", CLASS.legendBackground).append('rect')
.style('opacity', 0.75)
.style('fill', 'white')
.style('stroke', 'lightgray')
.style('stroke-width', 1)
.attr('height', getLegendHeight()-10)
.attr('height', getLegendHeight() - 10)
.attr('width', maxWidth);
}

Expand Down