Jump to content
Software FX Community

Limiting Data - Was using Chart.OpenData


alisdair_little
 Share

Recommended Posts

Al,

To pass plain data through the API, you can simply do something like:

Chart1.Data.Y[serIndex,pntIndex] = value;

Chart1.Data.X[serIndex,pntIndex] = xvalue;

There is not need for an OpenData call.

On the other hand, if you are wokring with a real time chart and need to add points at realtime, you can use the Realtime API provided.

Chart1.RealTime.BeginAddData(1, true);

Chart1.Data.Y[serIndex, Chart1.Data.Points - 1] = value;

Chart1.RealTime.EndAddData(true, false);

The first parameter in BeginAddData takes the number of points to pass and the second parameter appends allnew points to the end of the chart when set to true; when set to false points will be inserted at the beginning.

The frist boolean parameter in EndAddData allows  the X axis to scroll as points come in when set to true. The sencond parameter tells the chart to automatically scroll to the last added point.

Is this what you are looking for? Let me know.

 

Regards,

 

TT

Link to comment
Share on other sites

 Hi TT,

 

I have successfully moved the project over to using RealTime data.

I am getting a stack overflow when I use it though. I created a test rig application which worked fine, then ported this to the real application in which the data comes from a different thread ( I use InvokeRequired to ensure thread synchronization).

The previous version, ChartFx Lite worked fine.

Here is the stack trace of the exception;

at System.Drawing.Graphics.CheckErrorStatus(Int32 status) at System.Drawing.Graphics.FillEllipse(Brush brush, Int32 x, Int32 y, Int32 width, Int32 height) at ChartFX.WinForms.Internal.GraphicsEx.FillEllipse(Brush brush, Int32 x, Int32 y, Int32 w, Int32 h) at ChartFX.WinForms.bb.a(IGraphicsEx A_0, Int32 A_1, Int32 A_2, Int32 A_3, Int32 A_4, Brush A_5, Pen A_6, Boolean A_7, Color A_8) at ChartFX.WinForms.aw.a(IGraphicsEx A_0, Int32 A_1, Int32 A_2, Int32 A_3, MarkerShape A_4, Brush A_5, Pen A_6, Pen A_7, Boolean A_8, Font A_9, Image A_10, Color A_11) at ChartFX.WinForms.aw.a(Int32 A_0, Int32 A_1, Int32 A_2, Int32 A_3) at ChartFX.WinForms.aw.b(Int32 A_0, Int32 A_1, Int32 A_2) at ChartFX.WinForms.Galleries.Line.a(PaintMarkBase A_0, Int32 A_1, Int32 A_2, Int32 A_3, Int32 A_4, Boolean A_5) at ChartFX.WinForms.Galleries.Line.a(Int32 A_0, PaintMarkBase A_1, Int32& A_2, Int32& A_3) at ChartFX.WinForms.aw.a(Int32& A_0, Int32& A_1) at ChartFX.WinForms.aw.b(Int32& A_0, Int32& A_1) at ChartFX.WinForms.aw.u() at ChartFX.WinForms.aw.a(IFrame A_0, Int32& A_1) at ChartFX.WinForms.Chart.a(PaintBar A_0, IGraphicsEx A_1) at ChartFX.WinForms.ag.a(PaintEventArgs A_0) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at CDK.Program.Main(String[] args) in C:\Documents and Settings\alisdair\My Documents\Visual Studio 2005\Projects\cdk\CDK\Program.cs:line 28

 

Thanks,

 

Al

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...