Settings and activity

2 results found

  1. 6 votes
    How important is this to you?
    An error occurred while saving the comment
    David Coblentz commented  · 

    I'm having the same problem as well. I think it can be fixed with something like this:

    horizontal = legendOptions.layout === 'horizontal';

    // Adjust for legend
    if (legend.display && !legendOptions.floating) {
    if (align === 'right' && !horizontal) { // horizontal alignment handled first
    if (!defined(margin[1])) {
    chart.marginRight = mathMax(
    chart.marginRight,
    legend.legendWidth - legendX + legendMargin + spacing[1]
    );
    }
    } else if (align === 'left' && !horizontal) {
    if (!defined(margin[3])) {
    chart.plotLeft = mathMax(
    chart.plotLeft,
    legend.legendWidth + legendX + legendMargin + spacing[3]
    );
    }

    } else if (verticalAlign === 'top' && (horizontal || align === 'center')) {
    if (!defined(margin[0])) {
    chart.plotTop = mathMax(
    chart.plotTop,
    legend.legendHeight + legendY + legendMargin + spacing[0]
    );
    }

    } else if (verticalAlign === 'bottom' && (horizontal || align === 'center')) {
    if (!defined(margin[2])) {
    chart.marginBottom = mathMax(
    chart.marginBottom,
    legend.legendHeight - legendY + legendMargin + spacing[2]
    );
    }
    }
    }

    This shouldn't change the behavior for cases where the legend layout it vertical. For horizontal layouts, it allows verticalAlign of top and bottom with the align set to left, right, or center. If the layout is horizontal, and verticalAlign is middle, the legend will render on top of the chart, similar to the way that it would now for a horizontal layout, with a verticalAlign of middle and align of center.

    http://codepen.io/anon/pen/fKsFJ

    David Coblentz supported this idea  · 
  2. 232 votes
    How important is this to you?
    David Coblentz supported this idea  ·