FoxPro/Visual FoxPro - ayuda por favor

 
Vista:
sin imagen de perfil

ayuda por favor

Publicado por HUB (62 intervenciones) el 24/05/2006 14:50:40
Quisiera saber como podria generar (visualizar, impirmir) un grafico de barras, pie, etc teniendo como origen una tabla de Visual Foxpro.

Les agradeceria quew me enviaran un ejemplo claro.
Muchas gracias por su tiempo.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

RE:ayuda por favor

Publicado por Ernesto Hernandez (4623 intervenciones) el 24/05/2006 16:34:33
Espero te ayude este ejemplo ..

Suerte


*************************************************************
*** Grafica de Pastel en Excel con formateo de datos ***
*** Proceso de Envio a EXCEL ***
*************************************************************
oExcel = CREATEOBJECT("Excel.Application")
WITH oExcel
.Visible = .T.
.Workbooks.Add
.Worksheets(1).Activate
.Worksheets(1).Name = "GRAFICA"
.Columns("A:A").ColumnWidth = 45
.Columns("B:B").Select
.Selection.NumberFormat = "#,##0.00"
.Columns("E:E").ColumnWidth = 14.31
.Columns("E:E").Select
.Selection.NumberFormat = "#,##0.00"
.Selection.Font.Bold = .T.
.Range("A1:E1").Select
WITH .Selection.Font
.Bold=.T.
.Size = 14
.Name = "TAHOMA"
ENDWITH
WITH .Worksheets(1)
.Cells(1,1).Value = "MI EMPRESA"
.Cells(3,1).Value = "Fecha de Impresión: " + ALLTRIM(DTOC(DATE()))
ENDWITH
.Range("A3:E3").Select

WITH .Selection
.Merge
.MergeCells = .T.
.HorizontalAlignment = 1
.VerticalAlignment = 1
.Font.Bold = .T.
ENDWITH
.Worksheets(1).Cells(4,1).Value = "Fecha de Anásilis: " + ALLTRIM(DTOC(DATE())) && loFecha
.Range("A4:E4").Select
WITH .Selection
.Merge
.MergeCells = .T.
.HorizontalAlignment = 1
.VerticalAlignment = 1
.Font.Bold = .T.
ENDWITH
.Range("A3:E4").Select

** Borders(1) = Linea vertical interior
** Borders(2) = Linea vertical exterior
** LineStyle = 1,7 && Línea delgada continua
** LineStyle = 2 && Línea delgada discontinua
** LineStyle = 3,8 && Línea delgada discontinua de puntos
** LineStyle = 4 && Línea delgada discontinua linea-punto
** LineStyle = 5 && Línea delgada discontinua de puntos dobles
** LineStyle = 6 && Línea gruesa continua
** LineStyle = 9,12 && Línea doble fija delgada
** LineStyle = 10,11 && Línea punto_line delgada
WITH .Selection
.Borders(2).LineStyle = 1
.Borders(2).Weight = 3
.Borders(3).LineStyle = 1
.Borders(3).Weight = 3
.Borders(4).LineStyle = 1
.Borders(4).Weight = 3 && propiedad del de ancho de &&linea 1-4; 3 Optimo
ENDWITH

.Range("A4:E4").Select
WITH .Selection
.Borders(3).LineStyle = 1
.Borders(4).LineStyle = 1
ENDWITH
&& Titulo de ESQUEMACIÖN
.Range("A6:E6").Select
.Worksheets(1).Cells(6,1).Value = "PUBLICIDAD ESQUEMADA"
WITH .Selection.Font
.Bold=.T.
.Size = 12
.Name = "TAHOMA"
ENDWITH
WITH .Selection
.Merge
.MergeCells = .T.
.HorizontalAlignment = 1
.VerticalAlignment = 1
.Font.Bold = .T.

ENDWITH

WITH .Selection

.Borders(2).LineStyle = 1

.Borders(2).Weight = 3

.Borders(3).LineStyle = 1

.Borders(3).Weight = 3

.Borders(4).LineStyle = 1

.Borders(4).Weight = 3 && propiedad del de ancho de linea 1-4; 3 Optimo

ENDWITH

DIMENSION titulo(6)

DIMENSION valor(6)

titulo(1) = " TOTAL DE PAGINAS "

titulo(2) = " TOTAL DE CMS COLUMNARIO POR PAGINA "

titulo(3) = " TOTAL DE CMS COLUMNARIO POR EJEMPLAR "

titulo(4) = " TOTAL PUBLICIDAD PAGADA "

titulo(5) = " TOTAL PUBLICIDAD CORTESIA "

titulo(6) = " TOTAL NOTICIAS "


valor(1) = 32

valor(2) = 234

valor(3) = 7488

valor(4) = 3256

valor(5) = 1256

** valor(6) = crGraph.TTCCSINUSAR - (Thisform.Cant_norm+Thisform.Cant_cort)

valor(6) = valor(3) - (valor(4)+valor(5))

FOR I = 1 TO 6

&& Titulo de " TOTAL DE PAGINAS "

lc = 7+I

loK = "A"+ALLTRIM(STR(lc))+":A"+ALLTRIM(STR(lc))

.Range(loK).Select

.Worksheets(1).Cells(lc,1).Value = titulo(i)

.Worksheets(1).Cells(lc,2).Value = valor(i)

WITH .Selection.Font

.Bold=.T.

.Size = 10

.Name = "TAHOMA"

ENDWITH

WITH .Selection

.Merge

.MergeCells = .T.

.HorizontalAlignment = 1

.VerticalAlignment = 1

.Font.Bold = .T.

ENDWITH

NEXT



&& Realizamos la GRAFICA



.Charts.Add

.ActiveChart.ChartType = 70 && Tipo Pastel

.ActiveChart.SetSourceData(.Sheets("GRAFICA").Range("A11:B13"),2) && Rango de Datos

.ActiveChart.Location(2,"GRAFICA")

.ActiveChart.HasTitle = .T.

.ActiveChart.ChartTitle.Characters.Text = "MI EMPRESA"

.ActiveChart.SeriesCollection(1).ApplyDataLabels(3) && Tipo de Aplicación de Leyendas A LA IZQUIERDA

.ActiveSheet.Shapes("Gráfico 1").IncrementLeft(-173.25) && Posicionamiento de la Grafica a la Izquierda

.ActiveSheet.Shapes("Gráfico 1").IncrementTop(68.75) && Posicionamiento de la Grafica hacia Arriba

.ActiveSheet.Shapes("Gráfico 1").ScaleWidth(1.28,.F.,0) && Escala de Ancho de la Gráfica

.ActiveSheet.Shapes("Gráfico 1").ScaleHeight(1.15,.F.,0)&& Escala de Largo de la Gráfica



&& Escribimos las leyendas col letras mas chicas

.ActiveSheet.ChartObjects("Gráfico 1").Activate && "Grafico 1" = Título del Gráfico

.ActiveChart.ChartArea.Select

.ActiveChart.Legend.Select

loCont = .ActiveChart.Legend.LegendEntries.Count && Cantidades de Leyendas a Formatear, en este caso 3

FOR I = 1 TO loCont

.ActiveChart.Legend.LegendEntries(I).AutoScaleFont = .T.

With .ActiveChart.Legend.LegendEntries(I).Font

.Name = "Tahoma"

.Size = 8

.Strikethrough = .F.

.Superscript = .F.

.Subscript = .F.

.OutlineFont = .F.

.Shadow = .F.

.Underline = .F.

.ColorIndex = 0

ENDWITH

NEXT



&& Personalizamos Las leyedendas de Porcentajes

.ActiveSheet.ChartObjects("Gráfico 1").Activate

.ActiveChart.ChartArea.Select

loCont = .ActiveChart.SeriesCollection.Count

FOR I = 1 TO loCont

.ActiveChart.SeriesCollection(I).DataLabels.AutoScaleFont = .T.

With .ActiveChart.SeriesCollection(I).DataLabels.Font

.Name = "Verdana"

.Size = 8

.Bold = .T.

.Strikethrough = .F.

.Superscript = .F.

.Subscript = .F.

.OutlineFont = .F.

.Shadow = .F.

.Underline = .F.

.ColorIndex = 0

EndWith

NEXT



&& Guardamos la grafica


.ActiveWorkbook.SaveAs((CURDIR()+"Graph_Esquemacion.xls"), -4143, "", "", .F., .F.)

.WorkBooks.Close

ENDWITH


*oExcel = .NULL.

*RELEASE oExcel


************************************

*** FIN ***

************************************
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

RE:ayuda por favor

Publicado por HUB (62 intervenciones) el 24/05/2006 17:51:51
Gracias, lo probare ojala tenga exito, ops.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar