Author: excid3 Language: vbnet
Description: No description Timestamp: 2008-11-20 01:59:09 -0400
View raw paste Reply
  1.     Private Sub MakePieChart(ByVal g As Graphics, ByVal values() As Double, ByVal colors As Color())
  2.         ' draw the chart as line segments
  3.         Dim x As Int32 = 0
  4.         Dim y As Int32 = 0
  5.         Dim intSweep As Int32
  6.         Dim intAngle As Int32 = 0
  7.         Dim pieRectangle As Rectangle
  8.  
  9.         pieRectangle = New Rectangle(x, y, 147, 147)
  10.  
  11.         ' draw the arcs
  12.         For index As Int32 = 0 To values.Length() - 1
  13.             ' sweep of segment will be its ratio to the total and remembering the whole circle
  14.             ' has 360 degrees.
  15.             intSweep = CType((values(index) / sumOfPoints * 360), Int32)
  16.  
  17.             g.FillPie(New SolidBrush(colors(index)), pieRectangle, intAngle, intSweep)
  18.             intAngle += intSweep
  19.         Next
  20.     End Sub
View raw paste Reply