I used to introduce a web page dynamic generating picture method, found that this method is not good in practice, the application for stand-alone version is OK, but if the user requests for the C / S mode, each user request must regenerate a picture , Read and write a disk.
I have seen the method introduced in the latest cultivation I found that it is best to save the picture in the server's memory.
The following code can be done directly to display the pie chart.
/
<% @ Page language = "c #" ContentType = "image / jpeg"%>
<% @ Import namespace = "system.drawing"%>
Void Page_Load (Object Sender, Eventargs E)
{
Bitmap Image = New Bitmap (350, 200);
Graphics g = graphics.fromImage (image);
g.clear (color.white);
Rectangle Outline = New Rectangle (10, 5, 300, 100);
g.drawellipse (New Pen (Color.Black, 8.0F), OUTLINE
G.fillpie (New Solidbrush, Outline, -20F, 120F);
/ / These angles can be determined by comparison data in the database
G.fillpie (New Solidbrush (Color.Yellow), Outline, 100F, 120F);
G.fillpie (New Solidbrush (Color.Blue), Outline, 220F, 100F);
G.Fillpie (New Solidbrush (Color.green), Outline, 320F, 40F);
Image.save (Response.OutputStream, System.drawing.Imaging.imageFormat.jpeg);
}
script>
hEAD>