Getting result from sql and displaying it on Gruff pie chart

I have the following as my sql query:

@total = @report.report_items.find_by_sql “SELECT SUM(amount) FROM
report_items WHERE report_item_selected = ‘y’ AND available = ‘n’ AND
user_id = 1”

I am trying to add the value of SUM(amount) to a Gruff pie chart and it
does not seem to be working. I have the following:

g.data(“Items”, @total)

Does anyone know how to do this?

Thanks for your help

Problem sorted, thanks