home *** CD-ROM | disk | FTP | other *** search
Java Source | 2004-07-05 | 6.0 KB | 121 lines |
- import java.sql.*;
- import java.lang.*;
- import java.io.*;
- import javax.servlet.*;
- import javax.servlet.http.*;
-
- public class PieConfigServlet extends HttpServlet {
- //
- // This simple servlet is designed to demonstrate how a servlet can be used
- // to return configuration information to either the graphing applet or servlet.
- // As you will see the main routine ( doGet() ) uses the method
- // GraphData() to construct the return data.
- // Although in this example the GraphData() rountine simply builds the return
- // data from 'hard coded' values, in practice this rountine would be expanded
- // to first gather data from any number of datasources.
- // eg. databases, files other server processes.
- //
- // For further information visit,
- // http://www.jpowered.com/pie_chart/
- //
- //-----------------------------------------------------------------------------
-
- public void doGet(HttpServletRequest req, HttpServletResponse res)
- throws ServletException, IOException {
-
- res.setContentType("text/html");
- ServletOutputStream out = res.getOutputStream();
-
- // Return the Data
- out.println(ConfigData());
-
- } // End doGet
- //-----------------------------------------------------------------------------
- public void doPost(HttpServletRequest request,HttpServletResponse response)
- throws ServletException, IOException {doGet(request, response);}
- //-----------------------------------------------------------------------------
-
- public static String ConfigData() {
-
- String rsltStr =
- "<!-- Chart Switches --> \n"+
- "3D: true \n"+
- "Slabels: true \n"+
- "legend: true \n"+
- "displayPercentages: true \n"+
- "<!-- Chart Characteristics --> \n"+
- "width: 550 \n"+
- "height: 450 \n"+
- "nPies: 3 \n"+
- "depth3D: 15 \n"+
- "ndecplaces: 0 \n"+
- "3Dangle: 50 \n"+
- "<!-- Link Cursor --> \n"+
- "<!-- valid values are - crosshair, default, hand, move, text or wait --> \n"+
- "linkCursor: hand \n"+
- "<!-- Popup segment Value Pre & Post Symbols\n"+
- "valuepresym: $ \n"+
- "valuepostsym: \n"+
- "<!-- thousand seperater -->\n"+
- "thousandseparator: , \n"+
- "<!-- Additional font information --> \n"+
- "popupfont: Arial,B,12 \n"+
- "slabelfont: Arial,N,10 \n"+
- "<!-- Additional color information --> \n"+
- "bgcolor: white \n"+
- "labelcolor: 50,50,50 \n"+
- "popupbgcolor: 175,175,200 \n"+
- "<!-- Legend Information --> \n"+
- "legendfont: Arial,N,10 \n"+
- "legendposition: 400,250 \n"+
- "legendtitle: Sales Regions \n"+
- "LegendBackground: 255,255,255 \n"+
- "LegendBorder: 125,125,125 \n"+
- "LegendtextColor: 0,0,0 \n"+
- "<!-- Title --> \n"+
- "<!-- title text|xpos,ypos|Font|Color Defintion --> \n"+
- "title: Sales by Region|200,15|Arial,BI,16|grey \n"+
- "<!-- Free Form Text --> \n"+
- "<!-- textN text|xpos,ypos|Font|Color Defintion --> \n"+
- "text1: Product X|100,45|Arial,B,12|50,50,150 \n"+
- "text2: Product Y|350,100|Arial,B,12|50,150,50 \n"+
- "text3: Product Z|140,275|Arial,B,12|200,50,50 \n"+
- "<!-- Pie Data --> \n"+
- "<!-- PieN x,y,size,number of segments, seperation --> \n"+
- "Pie1: 80,55,115,6,0 \n"+
- "Pie2: 310,125,140,6,10 \n"+
- "Pie3: 80,300,175,6,10 \n"+
- "<!-- Pie Segement Labels --> \n"+
- "pie1label1: N.America \n"+
- "pie1label2: Europe \n"+
- "pie1label3: Asia \n"+
- "pie1label4: Africa \n"+
- "pie1label5: Australia \n"+
- "pie1label6: S.America \n"+
- "pie2label1: N.America \n"+
- "pie2label2: Europe \n"+
- "pie2label3: Asia \n"+
- "pie2label4: Africa \n"+
- "pie2label5: Australia \n"+
- "pie2label6: S.America \n"+
- "pie3label1: N.America \n"+
- "pie3label2: Europe \n"+
- "pie3label3: Asia \n"+
- "pie3label4: Africa \n"+
- "pie3label5: Australia \n"+
- "pie3label6: S.America \n"+
- "<!-- Segment Data --> \n"+
- "<!-- segmentN series color|legend label|URL|Target --> \n"+
- "segment1: 115,152,164|North America|http://www.jpowered.com|_self \n"+
- "segment2: 99,99,156|Europe|http://www.jpowered.com|_self \n"+
- "segment3: 185,53,8|Asia|http://www.jpowered.com|_self \n"+
- "segment4: 239,214,115|Africa|http://www.jpowered.com|_self \n"+
- "segment5: 0,63,68|Australia|http://www.jpowered.com|_self \n"+
- "segment6: 17,97,158|South America|http://www.jpowered.com|_self \n";
-
-
-
- return(rsltStr);
- }
- //-----------------------------------------------------------------------------
- } // End class