Showing posts with label 3d pie chart. Show all posts
Showing posts with label 3d pie chart. Show all posts

Thursday, November 5, 2009

Draw 3D pie diagram in Excel from magik


This piece of code will help to draw a 3d pie diagram in excel sheet from magik..


_block

e << OLE_Client.Create_Object("Excel.Application")
w << e.Workbooks()

w.add()
s << e.Sheets("Sheet1")
s.Name << "bhimu"
_for i _over range (1,10)
_loop
Cell << S.Range ("A"+i.print_string)
Cell.Value << i
Cell.Release_Object ()
Cell << S.Range ("B"+i.print_string)
Cell.Value << "=A"+i.print_string+"*"+"A"+i.print_string
Cell.Release_Object ()
_endloop


s.range("A1:B10").select
c << e.charts.add
c.ChartType << :|xl3DPieExploded|
e.ActiveChart.Location(:|xlLocationAsObject|, "bhimu")
e.Visible << _True

_endblock



if location is not specified, then the chart is added to a new sheet.