Pie Charts in VB.net -
im trying create pie chart , have seen many different ways of doing so. trying seemingly simplest method find cannot work. code below
if chkboxpiechart.checkstate = true dim percents() decimal = {estock, ewages, eadvertising, erent, eelectricity, erepayments, epackaging} dim colors() color = {color.blue, color.green, color.red, color.orange, color.purple, color.azure, color.chartreuse} dim graphics graphics = me.picboxpiechart.creategraphics dim location point = new point(462, 257) dim size size = new size(200, 200) drawpiechart(percents, colors, graphics, location, size) end if with being code drawpiechart sub
public sub drawpiechart(byval percents() decimal, byval colors() color, byval surface graphics, byval location point, byval piesize size) dim sum integer = 0 each percent integer in percents sum += percent next dim percenttotal integer = 0 percent integer = 0 percents.length() - 1 surface.fillpie(new solidbrush(colors(percent)), new rectangle(location, piesize), ctype(percenttotal * 360 / 100, single), ctype(percents(percent) * 360 / 100, single)) percenttotal += percents(percent) next return end sub any appreciated, thanks
Comments
Post a Comment