Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Microsoft .Net
 Real-Time Graphics Tools for .Net (VB and C#)
 How do I rescale time axis extents?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

soundar

51 Posts

Posted - 02 Feb 2010 :  19:40:22  Show Profile  Reply with Quote
I cannot figure out how to change the time axis extents in a QCRtGraph.NET once the graph is created.
In my program
  • I create the initialize the graph when the form loads. The scroll frame is an RT_MAXEXTENT_FIXEDSTART_AUTOSCROLL. If the form is loaded at 10:00AM then the time axis starts at 10:00 AM
  • User clicks the start button at 10:05. Data is fed to the graph and the first point is plotted at 10:05. This is acceptable.
  • User clicks Stop at 11:00. Data is stopped and the graph extent is now from 10 AM to 11AM User clicks Start again 1 PM
  • Now I clear the graph by using TruncateProcessVarDataset method and then update draw method. This also works.
  • But I want the time axis to start anew from 1 PM and continue. I cannot get this to happen - I tried transform's SetTimeScaleStart method, scrollframes RescaleAxesToCurrentTransform method etc, but whatever I tried, it either does not work or the program crashes with an invalid argument error inside the chart DLL.


I appreciate any help.I have searched these forums for any clue but cannot find anything that I have not tried.

quinncurtis

1586 Posts

Posted - 03 Feb 2010 :  10:22:38  Show Profile  Reply with Quote
You can use the ScrollFrame RescaleFrame method to do that


ChartCalendar newstarttime = ChartCalendar.NewCalendar(startTime);
ChartCalendar newendtime = ChartCalendar.NewCalendar(endTime);
newstarttime.Add(ChartCalendar.MINUTE, 60);
newendtime.Add(ChartCalendar.MINUTE, 60);

scrollFrame.RescaleFrame(newstarttime.GetCalendarMsecs(), scrollFrame.ChartObjScale.ScaleStartY,
newendtime.GetCalendarMsecs(), scrollFrame.ChartObjScale.ScaleStopY);

Go to Top of Page

soundar

51 Posts

Posted - 04 Feb 2010 :  15:42:51  Show Profile  Reply with Quote
Thanks. It worked.
Go to Top of Page

BarryRobertson

USA
21 Posts

Posted - 07 May 2012 :  23:06:59  Show Profile  Reply with Quote
I am having a similar problem. I tried setting with SetScaleStart/StopX and SetTmeScaleStart/Stop and now this option, but they all do the same thing.

The axis changes, but as soon as the scale needs to move with time, it reverts to the original setting I constructed it with.

Any ideas?
Go to Top of Page

quinncurtis

1586 Posts

Posted - 08 May 2012 :  09:15:45  Show Profile  Reply with Quote
Once created, the RTScrollFrame controls the coordinate system. It does pull it's starting values, and frame extent from original coordinate system values, but once it starts updating, it is completely driven by the RTProcessVar data values. So any changes to the coordinate system are temporary, because with each call to the ChartView UpdateDraw method, the RTScrollFrame always looks to its setup values and the data and adjusts the RTScrollFrame accordingly.

If you want to just change the x-axis extent of the scroll frame (maximumX - minimumX), you can do that using the scroll frames FrameExtent property, expressing the frame extent in milliseconds.

// change scroll frame extent to 240 seconds
scrollFrame1.FrameExtent = 240000

If you want to do more than that, you should adjust the coordinate the way you want, and then create a new RTScrollFrame using the adjusted coordinate system as the initial coordinate system value and adding in the RTProcessVar objects you want to control the scroll frame, just as you did when creating the original scroll frame. Then delete the old scroll frame from the ChartView object list, and add the new one in its place.

chartVu.DeleteChartObject(oldScrollFrame);
chartVu.AddChartObject(newScrollFrame);

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07