Sub Graphbtn_click
Activity.AddView(TabHost1, 0, 0, 100%x, 100%y)
Dim p As Panel
Dim PD As PieData
p.Initialize("")
pnlPie.Initialize("pnlPie")
' p.AddView(pnlPie, 0, 0, 100%x, 100%y - 100dip)
p.AddView(pnlPie, 0, 0, 100%x, 100%y - 100dip)
TabHost1.AddTab2("", p) '"Pie Chart"
PD.Initialize
PD.Target = pnlPie
'Set the target view
'Add the items. The last parameter is the color. Passing 0 will make it a random color.
Charts.AddPieItem(PD, Emaciated, 5, 0)
Charts.AddPieItem(PD, Thin, 10, 0)
Charts.AddPieItem(PD, Heavy, 20, 0)
Charts.AddPieItem(PD, Fat, 30, 0)
Charts.AddPieItem(PD, Average, 35, 0)
PD.GapDegrees = 5 'Total size of gaps between slices. Set to 0 for no gaps.
PD.LegendBackColor =Colors.ARGB(150, 100, 100, 100) 'The background color of the legend bitmap.
Dim legend As Bitmap
'This call draws the pie.
'PD - The pie data
'Colors.Gray - The view's background color
'True - Create a legend bitmap.
legend = Charts.DrawPie(PD, Colors.Gray, True)
Dim ImageView1 As ImageView
ImageView1.Initialize("")
ImageView1.SetBackgroundImage(legend)
pnlPie.AddView(ImageView1, 10dip, 10dip, legend.Width, legend.Height)
End Sub