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 & .Net Compact Framework
 QCChart2D and QCChart2D CF (VB and C#)
 Adding dataset to dataset
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

fsjodin

26 Posts

Posted - 18 Apr 2007 :  16:30:11  Show Profile  Reply with Quote
I would like to add a TimeSimpleDataset to another TimeSimpleDataset and end up with one dataset which has all the points from the two. For example, if the first data set has X values between 1/1/2007 and 1/31/2007 and the second has X values between 2/1/2007 and 2/28/2007 then I would like to end up with one dataset with values from 1/1/2007 and 2/28/2007.

I looked at CombineDataset method and it seems to be, as its name implies, perform a combination of the datasets.

What would the recommended way be to do what I am wanting to do? I know how to do it 'manually' by allocating new arrays, looping over the data and combining them that way but if there is a convenient / efficient way to do it through the APIs that would be even better.

Thanks

quinncurtis

1551 Posts

Posted - 18 Apr 2007 :  17:10:32  Show Profile  Reply with Quote
We don't have anything simplier than just appending the points one by one. You don't need the SortByX if you already know that the Dataset2 points are after the Dataset1 points.

TimeSimpleDataset Dataset1 = new TimeSimpleDataset(...);
TimeSimpleDataset Dataset2 = new TimeSimpleDataset(...);
.
.
for ( i=0; i < Dataset2.NumberDatapoints; i++)
	Dataset1.AddDataPoint(Dataset2.GetDataPoint(i));
Dataset1.SortByX(true);
Go to Top of Page

fsjodin

26 Posts

Posted - 18 Apr 2007 :  21:21:20  Show Profile  Reply with Quote
Is copying the points one-by-one reallocating the underlying array for each point? If so the copy would be inefficient for large data sets. Since both data sets are known, recreating the SimpleTimeDataset, reallocating the ChartCalendar array and y-axis arrays and using Array.Copy is probably more efficient. I was looking to see if there was a built-in API function that worked in that fashion, which I take it there is not, which is fine.

Thanks
Go to Top of Page

quinncurtis

1551 Posts

Posted - 18 Apr 2007 :  21:29:19  Show Profile  Reply with Quote
No, the datasets do not reallocate the internal buffers with each new added data point. The data buffers are up to twice as big as they need to be, to minimize reallocations when new data points are added. When the buffers do get reallocated, the are sized at twice as big as they need to be.
Go to Top of Page

fsjodin

26 Posts

Posted - 19 Apr 2007 :  11:35:43  Show Profile  Reply with Quote
Thanks, that is good to know
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