vendor/plugins/newrelic_rpm/ui/helpers/google_pie_chart.rb
# render the chart to html by creating an image object and
# placing the correct URL to the google charts api
render the chart to html by creating an image object and
placing the correct URL to the google charts api
render the chart to html by creating an image object and placing the correct URL to the google charts api
def render
    labels = ''
    values = ''
    @data.each do |label, value|
      labels << CGI::escape(label) + '|'
      values << (value * 100 / @max).round.to_s + ","
    end
    labels = labels[0..-2]
    values = values[0..-2]
    params = {:cht => 'p', :chs => "#{width}x#{height}", :chd => "t:#{values}", :chl => labels }
    params['chco'] = color if color
    url = "http://chart.apis.google.com/chart?#{to_query(params)}"
    alt_msg = "This pie chart is generated by Google Charts. You must be connected to the Internet to view this chart."
    html = "<img id=\"pie_chart_image\" src=\"#{url}\" alt=\"#{alt_msg}\"/>"
    return html       
  end
def render labels = '' values = '' @data . each do | label , value | labels << CGI :: escape ( label ) + '|' values << ( value * 100 / @max ) . round . to_s + "," end labels = labels [ 0 .. - 2 ] values = values [ 0 .. - 2 ] params = { :cht => 'p' , :chs => "#{width}x#{height}" , :chd => "t:#{values}" , :chl => labels } params [ 'chco' ] = color if color url = "http://chart.apis.google.com/chart?#{to_query(params)}" alt_msg = "This pie chart is generated by Google Charts. You must be connected to the Internet to view this chart." html = "<img id=\"pie_chart_image\" src=\"#{url}\" alt=\"#{alt_msg}\"/>" return html end
render the chart to html by creating an image object and
placing the correct URL to the google charts api
render the chart to html by creating an image object and placing the correct URL to the google charts api
# strip of the last separator char for labels and values