Ok heres the deal. What I do is I create a LineArray

// class data members
        static final int MaxPoints = 425;
        int     m_nLine = -1;                   // keep track of points in the line 
array
        Point3f m_p3  = new Point3f();

// what I do in the function
// I am creating a LineArray with the maximum number of points
// in my case its 425 because I am only displaying data for every minute
// and for the hole day it will not excede 425.
// (I do show the data for every second the data is comming, but only increment the 
line every minute)

                LineArray line = new LineArray(MaxPoints*2, GeometryArray.COORDINATES 
);

                line.setCapability(line.ALLOW_COORDINATE_READ);
                line.setCapability(line.ALLOW_COORDINATE_WRITE);

                draw( line );

                Appearance app = new Appearance();
                app.setCapability( app.ALLOW_MATERIAL_READ );
                app.setCapability( app.ALLOW_MATERIAL_WRITE );

                Material material = new Material();
                material.setCapability( Material.ALLOW_COMPONENT_WRITE );
                material.setLightingEnable( true );
                material.setAmbientColor( m_color );
                app.setMaterial(material);

                m_shape = new Shape3D( line, app );
                m_shape.setCapability( Shape3D.ALLOW_APPEARANCE_READ );
                m_shape.setCapability( Shape3D.ALLOW_APPEARANCE_WRITE );
                m_shape.setCapability( Shape3D.ALLOW_GEOMETRY_READ );
                m_shape.setCapability( Shape3D.ALLOW_GEOMETRY_WRITE );


// and later on in my draw function I do this
        void draw (LineArray line)
                {

                m_p3.x = 0;
                m_p3.y = m_yBase - m_coords[0]*m_yRatio;

                for (int i=1; i<m_counter; i++) {
                        line.setCoordinate( ++m_nLine, m_p3 );
                        m_p3.x += m_barWidth;
                        m_p3.y  = m_yBase - m_coords[i]*m_yRatio;
                        line.setCoordinate( ++m_nLine, m_p3 );
                }
                }



Now every time the data is comming, after every minute I will increment the line, so 
it will become visible. Tell me if you have any further questions

Ahmed

-----Original Message-----
From: Timmy Tong [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 03, 2001 7:40 AM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] LineStripArray Update at run time


Dear all,

I am now plotting a 3d graph based on some stock data. I use a
LineStripArray to draw the line. How can I update the line at run time when
some new data arrive?

Thank you very much.

Regards,
Timmy

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to