1     package sutut1;
2     
3     import javax.servlet.*;
4     import javax.servlet.http.*;
5     import java.io.*;
6     import java.util.*;
7     
8     import us.oh.state.common.utility.*;
9     
10    public class pie2 extends HttpServlet {
11    
12      public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
13        response.setContentType("application/pdf");
14        PdfChart page = new PdfChart(response.getOutputStream());
15        page.setTextColor(0x0);
16        page.setFont(page.BOLD, 24);
17        page.println("Tutorial - Pie 2");
18        page.setFont(page.NORMAL, 12);
19        page.println(new Date().toString());
20        PdfPieChart pie = new PdfPieChart();
21        PieSlice [] jvm = new PieSlice [] {
22          new PieSlice("LTH", 3.4, 0xff0000, 0xffaaaa),
23          new PieSlice("RAL", 2.9, 0x00ff00, 0xaaffaa),
24          new PieSlice("JCD", 7.5, 0x0000ff, 0xaaaaff),
25          new PieSlice("GDW", 4.1, 0xff00ff, 0xffaaff),
26          new PieSlice("RBB", 2.4, 0x00ffff, 0xaaffff)
27        };
28        pie.drawMain(page, jvm, 1.5, 5.0, 5.0, 5.0, 0.0);
29        pie.drawLegend(page, 6.5, 9.25, 1.0, 1.0, 0.09, 0.09, 0xdddddd, 2.0, 0x0);
30        page.close();
31      }
32    
33    }