app/models/miq_report/formatters/graph.rb
# Set the graph options based on chart width and height
Set the graph options based on chart width and height
Set the graph options based on chart width and height
def graph_options(w = 350, h = 250, options = nil)
      options ||= {}
      w = w.to_i
      h = h.to_i
      options[:legendwidth]  =  w - 10
      options[:legendheight] = h * 5 / 100
      options[:legendx] = 5
      options[:legendy] = 5
      options[:chartx]     = w * 20 / 100
      options[:chartwidth] = w * 75 / 100
      if w < 500
        options[:titlesize]  = 16
        options[:legendsize] = 10
        options[:chartsize]  = :small
      elsif w < 700
        options[:titlesize]  = 32
        options[:legendsize] = 12
        options[:chartsize]  = :medium
      else
        options[:titlesize]  = 48
        options[:legendsize] = 15
        options[:chartsize]  = :large
      end
      options[:totalwidth] = w
      if options[:chart2]                           
        if options[:composite]                      
          options[:totalheight] = h * 30 / 100      
          options[:charty]      = (h * 30 / 100) * 28 / 100
          options[:chartheight] = (h * 70 / 100) * 20 / 100
          options[:titlesize]   = options[:titlesize] * 3 / 4
          options[:no_legend]   = true
          options[:no_xlabels]  = nil
        else                                        
          options[:totalheight] = h * 70 / 100      
          options[:charty]      = h * 23 / 100
          options[:chartheight] = (h * 70 / 100) * 65 / 100
          options[:no_legend]   = nil
          options[:no_xlabels]  = true
        end
      else                                          
        options[:totalheight] = h
        options[:charty]      = h * 23 / 100
        options[:chartheight] = h * 70 / 100
      end
      options[:barchartheight] = h * 50 / 100       
      options[:barcharty]      = h * 40 / 100
      options[:piechartx] = w * 12 / 100            
      options[:piecharty] = h * 27 / 100
      options
    end
def graph_options ( w = 350 , h = 250 , options = nil ) options ||= { } w = w . to_i h = h . to_i options [ :legendwidth ] = w - 10 options [ :legendheight ] = h * 5 / 100 options [ :legendx ] = 5 options [ :legendy ] = 5 options [ :chartx ] = w * 20 / 100 options [ :chartwidth ] = w * 75 / 100 if w < 500 options [ :titlesize ] = 16 options [ :legendsize ] = 10 options [ :chartsize ] = :small elsif w < 700 options [ :titlesize ] = 32 options [ :legendsize ] = 12 options [ :chartsize ] = :medium else options [ :titlesize ] = 48 options [ :legendsize ] = 15 options [ :chartsize ] = :large end options [ :totalwidth ] = w if options [ :chart2 ] if options [ :composite ] options [ :totalheight ] = h * 30 / 100 options [ :charty ] = ( h * 30 / 100 ) * 28 / 100 options [ :chartheight ] = ( h * 70 / 100 ) * 20 / 100 options [ :titlesize ] = options [ :titlesize ] * 3 / 4 options [ :no_legend ] = true options [ :no_xlabels ] = nil else options [ :totalheight ] = h * 70 / 100 options [ :charty ] = h * 23 / 100 options [ :chartheight ] = ( h * 70 / 100 ) * 65 / 100 options [ :no_legend ] = nil options [ :no_xlabels ] = true end else options [ :totalheight ] = h options [ :charty ] = h * 23 / 100 options [ :chartheight ] = h * 70 / 100 end options [ :barchartheight ] = h * 50 / 100 options [ :barcharty ] = h * 40 / 100 options [ :piechartx ] = w * 12 / 100 options [ :piecharty ] = h * 27 / 100 options end
Set the graph options based on chart width and height
Set the graph options based on chart width and height
# Set sizes based on chart pixel width # Does this chart have a composite chart along with it # Rendering composite chart # Composite area is 30% of total height # Rendering main chart w/composite present # Main is 70% of total height # Rendering single chart # Special bar chart options # Special pie chart options # Legend font size #    options[:legendsize] = w < 500 ? 10 : 20
w
<not_specific>
h
<not_specific>
options
<not_specific>