private void DrawPic(int[] arr int n string heroname)
{ Bitmap bitmap = new Bitmap( )Graphics graphics
graphics = GraphicsFromImage(bitmap)
graphicsClear(ColorWhite)
graphicsDrawRectangle(PensBlack )
graphicsDrawString(heroname + 英雄分布 new Font(宋體 FontStyleBold) BrushesBlack new PointF())
//最大的值
int max_value = arr[]int total_value = arr[]
graphicsDrawString(總樣本點個數 + total_valueToString() new Font(宋體 FontStyleBold) BrushesBlue )
//縱坐標標識
int step = if (max_value > )
{ step = max_value / } else { step = } for (int i = i <= ++i)
{ graphicsDrawLine(new Pen(ColorBlue ) * i * i)graphicsDrawString((step * i)ToString() new Font(宋體 ) BrushesBlack * i)}
graphicsDrawString(玩家數 new Font(宋體 ) BrushesBlack )
//橫坐標標識
for (int i = i <= ++i)
{ graphicsDrawLine(new Pen(ColorBlue ) + * i + * i )graphicsDrawString(( * i)ToString() new Font(宋體 ) BrushesBlack + * i )}
graphicsDrawString(水平值 new Font(宋體 ) BrushesBlack )
//柱狀圖(線)
for (int i = i < ++i)
{ if (arr[i] != )
{ graphicsDrawLine(new Pen(ColorRed ) + * i + * i (arr[i] * ) / max_value)}
bitmapSave(ResponseOutputStream SystemDrawingImagingImageFormatGif)}
From:http://tw.wingwit.com/Article/program/net/201311/11685.html