La Web del Programador: Comunidad de Programadores
 
    Pregunta:  24486 - VISUALIZAR LOS PORCENTAJES DE UNA GRáFICA MSCHART DE VB
Autor:  JM S
Cuando hago una gráfica en Visual Basic no se visualizar el porcentaje o el numero de elementos de cada franja o barra del grafico por lo que solo veo el dibujo sin los datos o porcentajes de los elementos que cumplen la condición. Muchas gracias a todos por adelantado

  Respuesta:  luis acunña
Veo que hiciste la grafica, yo te quiero preguntar como se hace la grafica?. Estoy tratando de hacer una en VBA pero no he podido. Existe un codigo con el que no he podido para extraer los datos de la grafica de una hoja de calculo.

Este ejemplo crea un gráfico que depende de una hoja de cálculo. El nombre de serie está en la celda B1, los nombres de categoría se encuentran en las celdas A2:A28 y los valores están en las celdas B2:B28.

Sub BindToSpreadsheet()
Dim chConstants
Dim chtChart1

Set chConstants = ChartSpace1.Constants

NO HE SIDO CAPAZ CON LOS SIGUIENTES RENGLONES

' Set the data source of ChartSpace1 to Spreadsheet1.
Set ChartSpace1.DataSource = Spreadsheet1

' Set a variable to a new chart in Chartspace1.
Set chtChart1 = ChartSpace1.Charts.Add

' Set the chart type.
chtChart1.Type = chConstants.chChartTypeLineMarkers

' Bind the series name to cell B1 in the first sheet of Spreadsheet1.
chtChart1.SetData chConstants.chDimSeriesNames, chConstants.chDataBound, "B1"

' Bind the category axis to cell A2:A28 in the first sheet of Spreadsheet1.
chtChart1.SetData chConstants.chDimCategories, chConstants.chDataBound, "A2:A28"

' Bind the values of the data series to cells B2:B28 in the first sheet of Spreadsheet1.
chtChart1.SeriesCollection(0).SetData chConstants.chDimValues, chConstants.chDataBound, "B2:B28"

End Sub