use inetsoft report tool

解决方案 »

  1.   

    change 先生请说得详细一点 。 高分奉送
      

  2.   

    http://inetsoftcorp.com/cgi-bin/v6/htmlgen.pl?home/index.html
    http://www.inetsoftcorp.com/cgi-bin/v6/htmlgen.pl?download/deliver.html
      

  3.   

    用 jsp +  javabean 如何实现 , 有样例有重赏 
      

  4.   

    用 jsp +  javabean 如何实现 , 有样例有重赏  最好这些折点是可动态变化的、可控制的
      

  5.   

    http://www.free868.com/~jspuser/article/java/java2d/javagraph_java2d.htm#two
      

  6.   

    这个问题我自己处理好了 。 呵呵 /*
      file : DrawLine.java
    */
    import java.awt.*;import java.awt.geom.*;
    import java.awt.font.*;
    import java.util.*;
    import java.lang.*;
    import java.applet.Applet;public class DrawLine extends Applet{ TextField fromFld, toFld;
       String MyText;
       Label label, toLabel, fromLabel, statusLabel;
       PlotCanvas canvas;
       public int i;
       Button redb, blueb, domainChangeb;
       Color color;
    Panel panel1, panel2, bottomPanel, statusPanel, xdomainPanel;
       Choice fnChoice;
       float beginXmin = 0, beginXmax = 100;
    int MaxActByts;
    int actbyts;
    int[] ActByts; 
    int count=5;
        public void init() {
        MaxActByts = Integer.parseInt(getParameter("MaxActByts"));
        count = Integer.parseInt(getParameter("Row_count"));
        ActByts = new int[count];
        for ( int j=0;j<count;j++ ){
        ActByts[j] = Integer.parseInt(getParameter("ActByts"+j));
        }
       
        actbyts =Integer.parseInt(getParameter("ActByts0"));
       
        setLayout(new BorderLayout(5,5));

          panel1 = new Panel();
          label = new Label("Plotting a Function" + MaxActByts + "aa" + count);
          panel1.add(label);
          add("North", panel1);       

          canvas = new PlotCanvas(this,ActByts,count,MaxActByts);
          add("Center", canvas);
          fromLabel = new Label("-100");


         

          /* Bottom Panel, with from and to and status DrawLine. */
         
          bottomPanel = new Panel();
          bottomPanel.setLayout(new GridLayout(0,1,5,5));

          /* Domain panel */
          xdomainPanel = new Panel();

          xdomainPanel.add(new Label("Plot x from : "));  
          xdomainPanel.add(new Label("to : "));      
          bottomPanel.add(xdomainPanel);
         
          /* Status DrawLine */
          statusPanel = new Panel();
          statusLabel = new Label("                                           ");
          statusLabel.setForeground(Color.magenta);
          statusPanel.add(statusLabel);

          bottomPanel.add(statusPanel);

          add("South", bottomPanel);
    }


    class PlotCanvas extends Canvas {
       DrawLine containedBy;  
       public int mousex, mousey;
       public boolean isMouse = false;
       int timeThrough = 0;
       Color color = Color.green;
       int inset = 20;
       int fn = 0;
       float ymax, ymin, xmax, xmin;
    int[] ActByts;
    int count;
    int MaxActByts;
       PlotCanvas(DrawLine containedByIn,int[] ActByts_,int count_,int MaxActByts_) {
    super();
    containedBy = containedByIn;
    xmin = 0;
    xmax = 100;
    ActByts = ActByts_;
    count = count_;
    MaxActByts = MaxActByts_;
    }   public void changeColor (Color inColor) {
         color = inColor;
       }
         public void setFn(int newFn) {
         fn = newFn;
       }   public void setXmin(float newXmin) {
         xmin = newXmin;
       }   public float getXmin() {
         return(xmin);
       }   public void setXmax(float newXmax) {
         xmax = newXmax;
       }   /** Draws a box around this panel, plus other stuff. */
       public void paint(Graphics g) {
         int x, y;
         Dimension d = size();
         /* These need to be made into floats. */
         float xcur, ycur;
         float xplot, yplot;
         PlotCoord pc;


         g.drawRect(0,0, d.width - 1, d.height - 1);

         g.setColor(color);
         /* This time through is just to find out what the max y value is. */
         ymax = 0;
         ymin = 0;     
         ymax = MaxActByts;
         float stepSize = (xmax - xmin)/50;
         /*
         float stepSize = (xmax - xmin)/50;     
         for (xcur = xmin; xcur <= xmax; xcur += stepSize) {
           // The function we are going to plot. 
           ycur = func(xcur);

           if (ycur > ymax)
    ymax = ycur;
           if (ycur < ymin)
    ymin = ycur;
         }
         */
         pc = new PlotCoord (xmax, ymax, xmin, ymin, d.width, d.height, inset);


         int xcoord = 0, ycoord = 0;

         g.setColor(Color.black);

         float xaxisStart = xmax, xaxisEnd = xmin, xaxisPosy;
         float yaxisStart = ymax, yaxisEnd = ymin, yaxisPosx;;

         /* Axis rules:
            If 0 is on the map, print out the axis there.
            If 0 is not on the map, print out the axis on the 
            minimum. */

         if (xmin < 0  && xmax > 0) 
           yaxisPosx = 0;
         else
           yaxisPosx = xmin;

         if (ymin < 0  && ymax > 0) 
           xaxisPosy = 0;
         else
           xaxisPosy = ymin ;

         /*    System.out.println("Yaxis at x = " + yaxisPosx + 
            "  Xaxis at y = " + xaxisPosy);
            */

         Font f = new Font ("Dialog", Font.PLAIN, 10);
         g.setFont(f);

         /* Draw x axis. */
         g.drawLine(pc.xcoord(xaxisStart), pc.ycoord(xaxisPosy), 
            pc.xcoord(xaxisEnd), pc.ycoord(xaxisPosy));
         /* Draw y axis. */
         g.drawLine(pc.xcoord(yaxisPosx), pc.ycoord(yaxisStart),
            pc.xcoord(yaxisPosx), pc.ycoord(yaxisEnd));



         /* This draws one tick  on y */
         ycoord = pc.ycoord(ymin + (ymax - ymin)/2);
         xcoord = pc.xcoord(yaxisPosx);
        
         g.drawLine(xcoord+3, ycoord , xcoord - 3, ycoord);
         g.drawString(
           new Integer(Math.round(ymin + (ymax - ymin)/2)).toString(), 
      xcoord + 5, ycoord + 10);
     
     
         /* This draws one tick  on x */
         xcoord = pc.xcoord(xmin + (xmax - xmin)/2);
         ycoord = pc.ycoord(xaxisPosy);
        
         g.drawLine(xcoord, ycoord + 3, xcoord , ycoord - 3);
         g.drawString(
            new Integer(Math.round(xmin + (xmax - xmin)/2)).toString(), 
      xcoord -5, ycoord + 15);

         /* draw a tick at 0 if it is on the graph */
         if (xmin < 0  && xmax > 0) {
           xcoord = pc.xcoord(0);
           ycoord = pc.ycoord(xaxisPosy);
           g.drawLine(xcoord, ycoord + 3, xcoord , ycoord - 3);
           g.drawString("0", xcoord -5, ycoord + 15);
         }

         if (ymin < 0  && ymax > 0) {
           ycoord = pc.ycoord(0);
           xcoord = pc.xcoord(yaxisPosx);
           g.drawLine(xcoord+3, ycoord , xcoord - 3, ycoord);
           g.drawString("0", xcoord + 7, ycoord + 10);
         }

         /* Draw tick s at the max's. */

         /* This draws one tick  on y */
         ycoord = pc.ycoord(ymax);
         xcoord = pc.xcoord(yaxisPosx);

         g.drawLine(xcoord+3, ycoord , xcoord - 3, ycoord);
         g.drawString(
           new Integer(Math.round(ymax)).toString(), 
      xcoord + 5, ycoord + 10);

         /* This draws one tick  on x */
         xcoord = pc.xcoord(xmax);
         ycoord = pc.ycoord(xaxisPosy);

         g.drawLine(xcoord, ycoord + 3, xcoord , ycoord - 3);
    g.drawString(
            new Integer(Math.round(xmax)).toString(), 
      xcoord - 5, ycoord + 15);

         /* end of tick s at the max's. */


         g.setColor(color);

         int xcoordPrev = 0, ycoordPrev = 0;
         float xprev = 0, yprev = 0;
         stepSize = (xmax - xmin)/10;
         int k=0;
         for (xcur = xmin; xcur <= xmax; xcur += stepSize) {

          //ycur = func(xcur);       
          ycur=0;       
          
          if (k < count ){
           ycur = ((float)ActByts[k]);
          }
          k++;
          
    xcoord = pc.xcoord(xcur);
    ycoord = pc.ycoord(ycur);

           /* ie, don't do the very first x */
           if (xcur != xmin) {

    /*if (xcur > -0.01 && xcur < 0.01  )
    System.out.println( xprev + ":" + 
        xcoordPrev + "  " + 
        yprev + ":" + 
        ycoordPrev + "  " + 
        xcur + ":" + 
        xcoord + "  " + 
        ycur + ":" +
        ycoord);*/

    /*g.drawOval(xcoord-3, ycoord-3, 6, 6);*/

    g.drawLine(xcoordPrev, ycoordPrev, 
       xcoord, ycoord);

    }
    g.drawString(String.valueOf(ActByts[k]), xcoord, ycoord + 5);
           xcoordPrev = xcoord;
           ycoordPrev = ycoord;
           xprev = xcur;
           yprev = ycur;
    }
    }   float func( float x) {
         float retval;

         switch (fn) {
         case 0:
         retval = Math.abs(x) + 30;       
           break;
         case 1:       
           retval = x * x;
           break;
         case 2:
           retval = x * x * x;
           break;
         case 3:
           retval = x * x + x - 52;
           break;
         default:
           System.out.println("Bad function number");
           retval = -1;
         }
           return(retval);
       }
       /*  public boolean mouseDown(Event e, int x, int y) {
         Graphics gc;
         gc = getGraphics();

         isMouse = true;
         mousex = x;
         mousey = y;
         System.out.println("Got a mouse event at " + x + ", " + y);
         gc.setColor(color);
         System.out.println(color); 
         System.out.println(gc.getColor()); 
         gc.drawLine(mousex, mousey, mousex + 50, mousey + 10);
         return true;
       }
       */

    }
    }<!-- index.htm  --><html><head>
    <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
    <meta NAME="GENERATOR" CONTENT="Microsoft FrontPage 3.0">
    <title>SimplePlot.java</title>
    </head><body TEXT="#FFFFFF" BGCOLOR="#000000" LINK="#EEEE00" VLINK="#009999">
    <h1 align="center">Report Char</h1><hr align="center">
    <p align="center">
    <applet code="line70.class" width="600" height="400">
    <param name=MaxActByts value="6480">
     <param name=Row_Count value="10"><param name=ActByts0 value="36">
    <param name=ActByts1 value="12">
    <param name=ActByts2 value="176">
    <param name=ActByts3 value="159">
    <param name=ActByts4 value="2472">
    <param name=ActByts5 value="275">
    <param name=ActByts6 value="31">
    <param name=ActByts7 value="30">
    <param name=ActByts8 value="5922">
    <param name=ActByts9 value="6480">

    </applet>
    </p>
    <hr align="center">
    <b>
      

  7.   

    change  先生的建议不错。 谢谢! 不过 report tool 比较难需要一段时间研究。
      

  8.   

    这只是画折线 , 怎么画柱状图表呢?在jdk尚未支援 2D图形之前, Programmer只可以画出直的、相同粗细的线条。现在,我们就教您如何透过2D API绘出不同粗细的线条及圆滑的曲线。
    在package java.awt.geom中提供了Line2D、 QuadCurve2D及 CubicCurve2D等 classes,让 Programmer轻松地绘出想要的线条。http://www.free868.com/~jspuser/article/java/java2d/javagraph_java2d.htm#two http://www2.net668.net/grun/rainman/java/FgChart/FgChart.html
      

  9.   

    "PlotCoord" where i find it???????????????
      

  10.   

    怎么找不到PlotCoord?编译不能通过!
      

  11.   

    画柱状图表可以使用FREECHART控件,完全FREE,可到GOOGLE.COM中查找FREECHART