Page 1 of 1

Rotation performance on a pda/pocket device

Posted: Thu Mar 11, 2010 2:04 am
by 15655396
Hi,

I'm trying to chart at least 6000 (& preferably up to 10000) 3D points using a Points3D series. From there I want to allow the user to rotate, zoom etc to get a feel for the waveform. Although I'm doing this on a fairly high spec'd PDA (HTC HD2), I'm finding the rotation does not run smoothly. I've tried improving this by just rotating the outline (rotate1.Pen.Visible = true), but have found that the chart itself doesn't rotate (as expected), but the outline that is supposed to rotate is not visible.

Can you advise if I'm doing something wrong here, or there is some other way to make this work better? I've included an extract of code just in case it helps.

Thanks,
Michael L

This code is in the form's constructor:

Code: Select all

         tChart1 = new Steema.TeeChart.Pocket.TChart();
         points3D1 = new Steema.TeeChart.Styles.Points3D(tChart1.Chart);

         this.SuspendLayout();

         this.tChart1.Aspect.ZOffset = 0;
         this.tChart1.Axes.Bottom.Title.Transparent = true;
         this.tChart1.Axes.Depth.Title.Transparent = true;
         this.tChart1.Axes.DepthTop.Title.Transparent = true;
         this.tChart1.Axes.Left.Title.Transparent = true;
         this.tChart1.Axes.Right.Title.Transparent = true;
         this.tChart1.Axes.Top.Title.Transparent = true;
         
         this.tChart1.Location = new System.Drawing.Point(0, 0);
         this.tChart1.Name = "tChart1";
         this.tChart1.Size = new System.Drawing.Size(480, 560);
         this.tChart1.TabIndex = 0;

         tChart1.Panel.Color = Color.Wheat;
         tChart1.Header.Text = "TeeChart for SmartDevice";

         tChart1.Aspect.Orthogonal = false;
         tChart1.Aspect.Chart3DPercent = 100;
         tChart1.Aspect.ClipPoints = true;

         Steema.TeeChart.Tools.Rotate rotate1 = new Steema.TeeChart.Tools.Rotate(tChart1.Chart);
         rotate1.Pen.Visible = true;
         //rotate1.Pen.Color = Color.Black;
         tChart1.Tools.Add(rotate1);
         

         tChart1.Zoom.Allow = false;

         points3D1.ColorEach = false;
         points3D1.Pointer.Visible = false;

         Controls.Add(this.tChart1);

         this.ResumeLayout(false);
This code is run when I add the data:

Code: Select all

         List<Double>[] waveforms = motionAnalyser.xyzData.waveForms;

         tChart1.AutoRepaint = false;

         //points3D1.FillSampleValues();
         //for (int i = 0; i < 10; i++) {
         //   points3D1.Add(0, 0, i);
         //   points3D1.Add(10, 0, i);
         //   points3D1.Add(10 + 5 - i, 10, i);
         //   points3D1.Add(0 + 5 - i, 10, i);
         //   points3D1.Add(0, 0, i);
         //}

         for (int sampi = 0; sampi < waveforms[0].Count; sampi++) {
            points3D1.Add(waveforms[0][sampi], waveforms[1][sampi], waveforms[2][sampi]);
         }
         

         tChart1.Axes.Left.AdjustMaxMin();
         tChart1.Axes.Left.AutomaticMaximum = false;
         tChart1.Axes.Left.AutomaticMinimum = false;
         tChart1.Axes.Left.MinimumOffset = 50;
         tChart1.Axes.Left.MaximumOffset = 50;

         tChart1.Axes.Bottom.AdjustMaxMin();
         tChart1.Axes.Bottom.AutomaticMaximum = false;
         tChart1.Axes.Bottom.AutomaticMinimum = false;
         tChart1.Axes.Bottom.MinimumOffset = 50;
         tChart1.Axes.Bottom.MaximumOffset = 50;

         tChart1.Axes.Depth.AdjustMaxMin();
         tChart1.Axes.Depth.AutomaticMaximum = false;
         tChart1.Axes.Depth.AutomaticMinimum = false;
         tChart1.Axes.Depth.MinimumOffset = 50;
         tChart1.Axes.Depth.MaximumOffset = 50;

         tChart1.Legend.Visible = false;
         
         tChart1.AutoRepaint = true;
         tChart1.Refresh();
 

Re: Rotation performance on a pda/pocket device

Posted: Fri Mar 12, 2010 11:58 am
by 10050769
Hello Michael L,

I could reproduce your problem using Steema.TeeChart.Pocket version 4, but using WinForms your code it is not so slow.
Please you could check, using WinForms, if next code works faster.


form's constructor:

Code: Select all

   
      private Steema.TeeChart.Styles.Points3D points3D1;
        private void InitializeComponent()
        {
            this.mainMenu1 = new System.Windows.Forms.MainMenu();
            this.Menu = this.mainMenu1;
            this.components = new System.ComponentModel.Container();
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
            this.Text = "Form1";
            this.AutoScroll = true;
            tChart1 = new Steema.TeeChart.Pocket.TChart();
            points3D1 = new Steema.TeeChart.Styles.Points3D(tChart1.Chart);

            this.SuspendLayout();
            this.tChart1.Aspect.ZOffset = 0;
            this.tChart1.Axes.Bottom.Title.Transparent = true;
            this.tChart1.Axes.Depth.Title.Transparent = true;
            this.tChart1.Axes.DepthTop.Title.Transparent = true;
            this.tChart1.Axes.Left.Title.Transparent = true;
            this.tChart1.Axes.Right.Title.Transparent = true;
            this.tChart1.Axes.Top.Title.Transparent = true;
            this.tChart1.Location = new System.Drawing.Point(0, 0);
            this.tChart1.Name = "tChart1";
            this.tChart1.Size = new System.Drawing.Size(180, 260);
            this.tChart1.TabIndex = 0;

            tChart1.Panel.Color = System.Drawing.Color.Wheat;
            tChart1.Header.Text = "TeeChart for SmartDevice";

            tChart1.Aspect.Orthogonal = false;
            tChart1.Aspect.ClipPoints = true;

            Steema.TeeChart.Tools.Rotate rotate1 = new Steema.TeeChart.Tools.Rotate(tChart1.Chart);
            rotate1.Pen.Visible = true;
            //rotate1.Pen.Color = Color.Black;
            tChart1.Tools.Add(rotate1);
            tChart1.Zoom.Allow = false;
            points3D1.ColorEach = false;
            points3D1.Pointer.Visible = false;
            Controls.Add(this.tChart1);
            this.ResumeLayout(false);
        }
InitializeChart:

Code: Select all

public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        private void InitializeChart()
        {
            tChart1.AutoRepaint = false;
            points3D1.FillSampleValues(10000);

            tChart1.Axes.Left.AdjustMaxMin();
            tChart1.Axes.Left.AutomaticMaximum = false;
            tChart1.Axes.Left.AutomaticMinimum = false;
            tChart1.Axes.Left.MinimumOffset = 50;
            tChart1.Axes.Left.MaximumOffset = 50;

            tChart1.Axes.Bottom.AdjustMaxMin();
            tChart1.Axes.Bottom.AutomaticMaximum = false;
            tChart1.Axes.Bottom.AutomaticMinimum = false;
            tChart1.Axes.Bottom.MinimumOffset = 50;
            tChart1.Axes.Bottom.MaximumOffset = 50;

            tChart1.Axes.Depth.AdjustMaxMin();
            tChart1.Axes.Depth.AutomaticMaximum = false;
            tChart1.Axes.Depth.AutomaticMinimum = false;
            tChart1.Axes.Depth.MinimumOffset = 50;
            tChart1.Axes.Depth.MaximumOffset = 50;
            tChart1.Legend.Visible = false;
            tChart1.AutoRepaint = true;
            tChart1.Refresh();

        }
On the other hand, I recommend see next article,choose Real-Time Charting and try to do all things are done in it for optimize chart in real time. Also, you can find more examples in Demos project concretely in speed examples.

I hope will helps.

Thanks,

Re: Rotation performance on a pda/pocket device

Posted: Mon Mar 15, 2010 3:51 am
by 15655396
Thanks for the reply Sandra.

I am using TeeChartNET2009VSNET2008_4.0.2009.62332 (the most recent as of about a week ago), on a Windows 7 x64 PC, with VS 2008. I am a bit confused where you distinguish between version 4 and WinForms... not sure what you want me to do there.

I tried using your example code (except for the menu lines) and found little difference in performance. I've also attempted to follow the real-time charting article. The things I implemented did not help much, other things (about half) I couldn't implement because I couldn't find the .NET equivalent calls.

You said that you found doing the rotations 'not so slow'. I find that when I click and drag the screen with the rotation tool activated (and 10000 points displayed), it takes about 2 seconds to respond. With say 100 points it is just about instantaneous.

I've also tried:
- plotting simple points instead of lines
- different chart display size (your 180x260, my 480x517)
- release and debug mode
None seem to help much.

Any other advice on how to speed it up would be appreciated.

Regards,
Michael

Re: Rotation performance on a pda/pocket device

Posted: Mon Mar 15, 2010 1:12 pm
by 10050769
Hello Michael,

I am using TeeChartNET2009VSNET2008_4.0.2009.62332 (the most recent as of about a week ago), on a Windows 7 x64 PC, with VS 2008. I am a bit confused where you distinguish between version 4 and WinForms... not sure what you want me to do there.
Always, I am using version 4 of TeeChart .Net both WinForms version as to version compact framework
You said that you found doing the rotations 'not so slow'. I find that when I click and drag the screen with the rotation tool activated (and 10000 points displayed), it takes about 2 seconds to respond. With say 100 points it is just about instantaneous.
Sorry, I am not explained well. I wanted to say that using same code in the 2 environments is much slower CF.
Therefore, we believe that the main problem is that Compact Framework is slower than. NET Framework.

Please, see attached projects that using same code, but one is made with WinForms and the other with Compact Framework and compare their running times that appears in label or header of Chart for see difference

Thanks,
WinForms Project:
Rotation_test.zip
(13.73 KiB) Downloaded 338 times
CF Project:
rotation_test2.zip
(8.08 KiB) Downloaded 359 times

Re: Rotation performance on a pda/pocket device

Posted: Mon Mar 15, 2010 11:29 pm
by 15655396
Hi Sandra,

Yes that's basically the same conclusion I had been coming to. For the benefit of others I have found an interesting way to get around this problem. I am using the Tchart's MouseDown and MouseUp events (inherited from Control), to detect when the user wishes to rotate or zoom. On MouseDown the chart is 'converted' to one that plots every 5th point, and on MouseUp it goes back to plotting all points. Thus the graph can be rotated or zoomed while showing an approximate version of itself, and when the operation is completed it goes back to showing the chart in full detail.

Critical code elements given below:

The handlers:

Code: Select all

      private void tChart1_MouseDown(Object sender, MouseEventArgs e)
      {
         ////
         // Change waveform to a decimated one so it is quicker to rotate
         ////
         points3D1.Clear();
         DisplayGraph(5);
      }

      private void tChart1_MouseUp(Object sender, MouseEventArgs e)
      {
         ////
         // Change waveform back to the full sized one
         ////
         points3D1.Clear();
         DisplayGraph(1);
      }
The display function:

Code: Select all

      private void DisplayGraph(int decimator)
      {
         List<Double>[] waveforms = motionAnalyser.xyzData.waveForms;

         tChart1.AutoRepaint = false;
         
         for (int sampi = 0; sampi < waveforms[0].Count; sampi += decimator) {
            points3D1.Add(waveforms[0][sampi], waveforms[1][sampi], waveforms[2][sampi]);
         }

         tChart1.AutoRepaint = true;
         tChart1.Refresh();

      } //end DisplayGraph()
Extract from the constructor:

Code: Select all

         tChart1.MouseDown += new MouseEventHandler(tChart1_MouseDown);
         tChart1.MouseUp += new MouseEventHandler(tChart1_MouseUp);
Regards,

Michael L

Re: Rotation performance on a pda/pocket device

Posted: Tue Mar 16, 2010 1:27 pm
by 10050769
Hello Michael L,

Thanks for the feedback, we hope it will be helpful for other users.