Webform Calendar

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
MikeTheLad
Newbie
Newbie
Posts: 65
Joined: Mon Jan 19, 2004 5:00 am

Webform Calendar

Post by MikeTheLad » Wed Aug 08, 2007 10:04 am

Trying to get a calendar to work on webform with the following code:-

Steema.TeeChart.Styles.Calendar cal = new Steema.TeeChart.Styles.Calendar(this.WebChart1.Chart)

Getting error:-

Object reference not set to an instance of an object.

But I can use the following to make a bar graph work:-

Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(this.WebChart1.Chart)

I am missing something, can you get a calendar to work on a webform, the demo is showing windows form.

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Wed Aug 08, 2007 10:17 am

Hi MikeTheLad

Which TeeChart version are you using? Here It's working fine using lastest release (Build 3.2.2763.26081/2 "available at the web") and the below code:

Code: Select all

Steema.TeeChart.Styles.Calendar calendar1 = new Steema.TeeChart.Styles.Calendar(this.WebChart1.Chart); 
(WebChart1.Chart.Series[0] as Steema.TeeChart.Styles.Calendar).FillSampleValues();
Could you please try with the last version?
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

MikeTheLad
Newbie
Newbie
Posts: 65
Joined: Mon Jan 19, 2004 5:00 am

Post by MikeTheLad » Wed Aug 08, 2007 1:12 pm

Am using Teechart v1 (Build 1.1.2531.28391

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 Aug 08, 2007 1:20 pm

Hi MikeTheLad,

Yes, you are right, this is a bug in v1 but works fine like this:

Code: Select all

			Steema.TeeChart.Styles.Calendar calendar1 = new Steema.TeeChart.Styles.Calendar();
			WebChart1.Chart.Series.Add(calendar1);
			WebChart1.Chart.Series[0].FillSampleValues();
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

MikeTheLad
Newbie
Newbie
Posts: 65
Joined: Mon Jan 19, 2004 5:00 am

Post by MikeTheLad » Wed Aug 08, 2007 1:30 pm

thanks that works fine now.

What I am trying to achieve is to display a name(s) on certain days. is this going to be possible?

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 Aug 08, 2007 2:05 pm

Hi MikeTheLad,

You can draw text in a calendar cell using something like the code below using RectCell(Column, Row) method.

Code: Select all

  protected void Page_Load(object sender, EventArgs e)
  {			
		Steema.TeeChart.Styles.Calendar calendar1 = new Steema.TeeChart.Styles.Calendar();
		WebChart1.Chart.Series.Add(calendar1);
		calendar1.FillSampleValues();
  }

	protected void WebChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
	{
		Steema.TeeChart.Styles.Calendar calendar1 = ((Steema.TeeChart.Styles.Calendar)WebChart1.Chart[0]);
		System.Drawing.Rectangle Rect = calendar1.RectCell(2, 5);
	}
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

MikeTheLad
Newbie
Newbie
Posts: 65
Joined: Mon Jan 19, 2004 5:00 am

Post by MikeTheLad » Wed Aug 08, 2007 2:14 pm

the WebChart1_AfterDraw function is not being called

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 Aug 08, 2007 2:17 pm

Hi MikeTheLad,

You need to assign the WebChart's AfterDraw event at design-time or at run-time like this:

Code: Select all

  protected void Page_Load(object sender, EventArgs e)
  {			
		Steema.TeeChart.Styles.Calendar calendar1 = new Steema.TeeChart.Styles.Calendar();
		WebChart1.Chart.Series.Add(calendar1);
		calendar1.FillSampleValues();

		//AfterDraw event definition
		WebChart1.AfterDraw+=new Steema.TeeChart.PaintChartEventHandler(WebChart1_AfterDraw);
  }

	protected void WebChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
	{
		Steema.TeeChart.Styles.Calendar calendar1 = ((Steema.TeeChart.Styles.Calendar)WebChart1.Chart[0]);
		System.Drawing.Rectangle Rect = calendar1.RectCell(2, 5);
	}
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

MikeTheLad
Newbie
Newbie
Posts: 65
Joined: Mon Jan 19, 2004 5:00 am

Post by MikeTheLad » Wed Aug 08, 2007 2:21 pm

It is now being called, but nothing is being drawn from what I can see

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 Aug 08, 2007 2:28 pm

Hi MikeTheLad,

Sorry, my fault. AfterDraw event should be as shown below. Removing unnecessary code I removed more than I should.

Code: Select all

	protected void WebChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
	{
		Steema.TeeChart.Styles.Calendar calendar1 = ((Steema.TeeChart.Styles.Calendar)WebChart1.Chart[0]);
		System.Drawing.Rectangle Rect = calendar1.RectCell(2, 5);

		g.TextOut(Rect.Left, Rect.Top, "My Text");
	}
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

MikeTheLad
Newbie
Newbie
Posts: 65
Joined: Mon Jan 19, 2004 5:00 am

Post by MikeTheLad » Wed Aug 08, 2007 2:43 pm

That works fine thanks. I presume this is not a formuale to work out where to place for each day. Is it just a matter of guessing on this.

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 Aug 08, 2007 2:50 pm

Hi MikeTheLad,

There are DayOneColumn and DayOneRow properties which may help you identify the cells.
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

MikeTheLad
Newbie
Newbie
Posts: 11
Joined: Mon Jan 19, 2004 5:00 am

Post by MikeTheLad » Mon Aug 13, 2007 10:44 am

Is it possible to have a hover popup as you go over the dates

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 Aug 13, 2007 11:17 am

Hi MikeTheLad,

TeeChart for .NET v2 and v3 include HotSpots tool for that but I'm afraid this won't work fine with Calendar series. Anyway, I'll add your request to our wish-list to be considered for inclusion in future releases.
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

MikeTheLad
Newbie
Newbie
Posts: 65
Joined: Mon Jan 19, 2004 5:00 am

Post by MikeTheLad » Thu Aug 23, 2007 9:36 am

Is it possible to not show the weekends?

Post Reply