Function CalcularGastosParaGrafica(Todos As Boolean)
Dim Column As Integer
Dim Row As Integer
Dim MesD As Integer
Dim MesH As Integer
MesD = 1
MesH = 12
If Todos = False Then
'filtra por los meses
//no se lo mando porque no deja enviar tanto texto el foro
end if
With Grafica
' Muestra un gráfico 3d con 8 columnas y 8 filas
' de datos.
.chartType = 3
.ColumnCount = 12
.RowCount = 4
'asigna el valor debuelto por los calculos a la grafica
For Column = 1 To 12 'meses
For Row = 1 To 4 'rubros
.Column = Column
.Row = Row
If .Column >= MesD And .Column <= MesH Then
.Data = CalcularGastoEnViaticos(Column, Row, Todos) 'numero de mes y numero de rubro
Else
.Data = 0
End If
Next Row
Next Column
.Plot.SeriesCollection(1).LegendText = "TAXIS"
.Plot.SeriesCollection(2).LegendText = "BUSES"
.Plot.SeriesCollection(3).LegendText = "ALIMENTACION"
.Plot.SeriesCollection(4).LegendText = "OTROS"
' Utiliza el gráfico como fondo de la leyenda.
.ShowLegend = True
.SelectPart VtChPartTypePlot, index1, index2, _
index3, index4
.EditCopy
.SelectPart VtChPartTypeLegend, index1, _
index2, index3, index4
.EditPaste
End With
End Function