manually adding data to series with dates along the X Axis

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Adrian
Advanced
Posts: 116
Joined: Thu Jun 23, 2005 4:00 am

manually adding data to series with dates along the X Axis

Post by Adrian » Wed Nov 08, 2006 1:10 pm

I need to be able to add bars to an error bar series where my x axis is a date so I need an add method like

Code: Select all

errorbar.add(x as date,y as double,errorvalue as double,text as string,colour as System.Drawing.Color)
there doesn't appear to be one... closest I can find is

Code: Select all

errorbar.add(x as double,y as double,errorvalue as double,text as string,colour as System.Drawing.Color)
which means I'll need to create a string for my date and convert my date into a double... this will be a real pain...

There are a number of series types that do not appear to allow dates, bubble is another one, if I have a date along the xaxis I can;t specify the radius...

is this an oversight or is there another way to add the data I need?
Adrian Heald
Captell Developments
www.captelldevelopments.com

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Nov 08, 2006 4:50 pm

Hi Adrian,

You don't need to convert a date to a double manually, you can use DateTime.Parse method like this:

Code: Select all

		private void Form1_Load(object sender, EventArgs e)
		{
			Random val = new Random();

			errorBar1.Add(DateTime.Parse("1/1/2007"), val.Next(), "First Bar", Color.Red);
			errorBar1.Add(DateTime.Parse("2/1/2007"), val.Next(), "Second Bar", Color.Blue);
			errorBar1.Add(DateTime.Parse("3/1/2007"), val.Next(), "Third Bar", Color.Yellow);

			tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Value;			
		}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Adrian
Advanced
Posts: 116
Joined: Thu Jun 23, 2005 4:00 am

Post by Adrian » Fri Nov 10, 2006 12:49 am

I think you have missed my point.

Here is another example.

I want to create a arrow chart. I have a data table with 4 columns

startdate,startusers,enddate,endusers

startdate and enddate are date types, startusers and endusers are of type double.

I want an arrow pointing from point (startdate,startusers) to point (enddate,endusers).

There isn't an ADD method that allows

date,double,date,double
Adrian Heald
Captell Developments
www.captelldevelopments.com

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Nov 10, 2006 9:06 am

Hi Adrian,
I think you have missed my point.


If I'm not wrong you asked for that:
I need to be able to add bars to an error bar series where my x axis is a date so I need an add method like

Code:

errorbar.add(x as date,y as double,errorvalue as double,text as string,colour as System.Drawing.Color)
In my humble opinion, my previous message replied to that request. However now you say:
I want to create a arrow chart. I have a data table with 4 columns

startdate,startusers,enddate,endusers

startdate and enddate are date types, startusers and endusers are of type double.

I want an arrow pointing from point (startdate,startusers) to point (enddate,endusers).
Could you please let me know the exact series style you wish to use for your chart and we'll try to give an answer to your request?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Adrian
Advanced
Posts: 116
Joined: Thu Jun 23, 2005 4:00 am

Post by Adrian » Fri Nov 10, 2006 11:26 pm

Hi there,
There are several series which do not cater for adding the key values in a single ADD method. ERRORBAR is just one example, i.e. there is no ADD method of the following signature.

Code: Select all

errorbar.add(x as date,y as double,errorvalue as double,text as string,colour as System.Drawing.Color) 
BUBBLE is another one that I have to code around like

Code: Select all

iPoint = serBubble.Add(row(XValueName), CDbl(row(YValueName)))

serBubble.RadiusValues.Item(iPoint) = row(Radius)  ' add the radius
In this case I have to add the radius in separately to the initial add because there is no ADD method that allows a DATE and the radius.

I'm loading the data from a data table where the X column is of type DATETIME.

Alternatively I can use a statement like

Code: Select all

If TypeOf row(StartXValues) Is Date Then
   dStartXValues = row(StartXValues).tooadate
Else
   dStartXValues = row(StartXValues)
End If

iPoint = serArrow.Add(dStartXValues, dStartYValues, dEndXValues, dEndYValues)
Which converts the date to a double first... this is what I meant by converting the date.

I'm using tCHART in a generic reporting tool so I have very little idea or control of what my users want to include in their charts... It would be a great idea it ALL series types with X and Y axis allow ALL numeric types on both X and Y as well as DATE time types and allows specification of the other key metrics (such as Radius for the bubble etc.) in a single ADD method.

In the short term I've figured out ways to code around the problems I'm having.

Cheers..
Adrian Heald
Captell Developments
www.captelldevelopments.com

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Nov 13, 2006 9:49 am

Hi Adrian,

Have you looked to all bubble series add method overloads? There are a number of them which admit radius as a parameter. Regarding the DateTime values to double you can do something like this:

Code: Select all

			bubble1.XValues.DateTime = true;

			bubble1.Add(DateTime.Parse("1/1/2007").ToOADate(), 2, 5);
			bubble1.Add(DateTime.Parse("1/2/2007").ToOADate(), 3, 3);
			bubble1.Add(DateTime.Parse("1/3/2007").ToOADate(), 4, 1);	
This code snippet converts DateTime values to double using ToOADate method a double y value and a double radius.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply