lib/gruff/mini/legend.rb
##
# The canvas needs to be bigger so we can put the legend beneath it.
The canvas needs to be bigger so we can put the legend beneath it.
The canvas needs to be bigger so we can put the legend beneath it .
def expand_canvas_for_vertical_legend
        return if @hide_mini_legend
        @legend_labels = store.data.map(&:label)
        legend_height = scale_fontsize(store.length * calculate_line_height + @top_margin + @bottom_margin)
        @original_rows = @raw_rows
        @original_columns = @raw_columns
        case @legend_position
        when :right
          @rows = [@rows, legend_height].max
          @columns += calculate_legend_width + @left_margin
        else
          font = @legend_font.dup
          font.size = scale_fontsize(font.size)
          @rows += store.length * calculate_caps_height(font) * 1.7
        end
        @renderer = Gruff::Renderer.new(@columns, @rows, @scale, @theme_options)
      end
def expand_canvas_for_vertical_legend return if @hide_mini_legend @legend_labels = store . data . map ( & :label ) legend_height = scale_fontsize ( store . length * calculate_line_height + @top_margin + @bottom_margin ) @original_rows = @raw_rows @original_columns = @raw_columns case @legend_position when :right @rows = [ @rows , legend_height ] . max @columns += calculate_legend_width + @left_margin else font = @legend_font . dup font . size = scale_fontsize ( font . size ) @rows += store . length * calculate_caps_height ( font ) * 1.7 end @renderer = Gruff :: Renderer . new ( @columns , @rows , @scale , @theme_options ) end
The canvas needs to be bigger so we can put the legend beneath it.
The canvas needs to be bigger so we can put the legend beneath it .