def reparto_de_ventas_por_marca
#obtener los montos de las ventas en el periodo comprendido y sumarlas
@ventas = Venta.find(:all)
@marcas = Marca.find(:all)
title = Title.new("Ingresos de este mes: #{@total}")
pie = Pie.new
pie.start_angle = 35
pie.animate = true
pie.tooltip = '#val# de #total#<br>#percent# de 100%'
pie.colours = ["#245a9c", "#fff"]
pie.values = [
@marcas.each do |result|
PieValue.new(result.ventas.count, result.name)
end
]
chart = OpenFlashChart.new
chart.title = title
chart.add_element(pie)
chart.x_axis = nil
render :text => chart.to_s
end
It just doesn't works i need to get the values to create a graph with flash chart.
any help will be appreciated.