Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating charts
Message
De
10/04/2001 14:00:16
 
 
À
10/04/2001 04:41:53
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Divers
Thread ID:
00493326
Message ID:
00494107
Vues:
79
Hi Cetin,

Thanks for this excellent example.

I'm going to try this method out and compare it to MSGRAPH9 .. which is the version we're working with.

Thanks again!

Scott

>Scott,
>Performance is always a problem. As I could see most time consuming part is first loading of Excel. Once loaded subsequent calls to Excel object creation are exceptionally faster. Here is a sample code that you could test speed :
>
* Part of xlChartType constants
>#Define xl3DArea 					-4098
>#Define xl3DColumn					-4100
>#Define xl3DLine					-4101
>#Define xl3DPie						-4102
>#Define xlArea						1
>#Define xlBubble3DEffect			87
>#Define xlLine						4
>#Define xlPie						5
>#Define xlRadar						-4151
>#Define xlSurface					83
>
>*** set the LOCALEID to English
>nlLocaleId=sys(3004)		&& Save local id
>=sys(3006,1033)			&& We will be sending instructions in English
>ox = crea('excel.application')
>ox.workbooks.add()
>With ox.activeworkbook.worksheets(1)
>  .Cells(1,1).Value = "Product"
>  .Cells(1,2).Value = "AMount"
>  .Cells(1,3).value = "Quota"
>  .Cells(2,1).Value = "Prod1"
>  .Cells(2,2).Value = 12000
>  .Cells(2,3).value = 11000
>  .Cells(3,1).Value = "Prod2"
>  .Cells(3,2).Value = 45000
>  .Cells(3,3).value = 48000
>  .Cells(4,1).Value = "Prod3"
>  .Cells(4,2).Value = 37000
>  .Cells(4,3).value = 38000
>  oChart = .ChartObjects.Add(60, 60, 300, 200)
>*!*	  ox.charts.add
>*!*	  ox.charts(1).chartwizard(.range(.Cells(1,1),.Cells(4,3)),xl3DColumn,4,1,0,1,1,"","","","")
>  oChart.Chart.chartwizard(.range(.Cells(1,1),.Cells(4,3)),xl3DColumn,4,1,0,1,1,"","","","")
>Endwith
>With oChart.Chart
>  .hastitle = .t.
>  .haslegend = .t.
>  .ChartTitle.caption = "This is chart title"
>*	.ChartType=xlBubble3DEffect  && Set a charttype
>  .plotby = 2
>* Now play with chart format
>  #Define xlCategory		1
>  #Define xlValue			2
>  #Define xlSeriesAxis	3
>  With .Axes(xlValue)
>    .hastitle = .T.
>    With .AxisTitle
>      .Caption = "This is Rotated Value title"
>      .Font.Size = 10
>      .Font.Bold = .f.
>      .Orientation = 90 && Show 90 degrees rotated - clockwise
>    Endwith
>  Endwith
>*  .charttype = xl3DLine  && Change charttype in between
>*    	.PrintOut   && Print chart
>  #Define xlSourceChart 5
>  #Define xlHTMLStatic 0
>  #Define xlHTMLChart 3
>  ox.activeworkbook.PublishObjects.Add(xlSourceChart, "C:\temp\EXCELExport.htm", ;
>    ox.activeworkbook.worksheets(1).name,.Parent.Name, ;
>    xlHTMLStatic, "", "Published From Excel").Publish(.t.)
>*!*	 ox.activeworkbook.PublishObjects.Add(xlSourceChart, ;
>*!*	    "C:\temp\myChartTest.htm", "My Chart", '', xlHTMLStatic).Publish(.t.)
>*!*	  #DEFINE xlHTML 44
>*!*	  ox.charts(1).SaveAs("c:\temp\myExcelFile.htm", xlHTML)
>Endwith
>ox.activeworkbook.saved = .t. && Suppress save dialog
>ox.quit      && Quit excel
>=sys(3006,val(nlLocaleId))
However if your charts are basic types like column or bar I probably wouldn't use any 3rd party and draw the chart with div, span, table tags. ie: This works on IE and NS :
>
>
>< style >
>.color1 {background-color:#ffff00}
>.color2 {background-color:#ff00ff}
>.color3 {background-color:#00ffff}
>< /style >
>...
>< span class="color1" >  < /span >
>...
>
>Cetin
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform