Webform Calendar
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi MikeTheLad,
I'm afraid this is not possible for now. I've added your request to our wish-list to be considered for inclusion in future releases.
I'm afraid this is not possible for now. I've added 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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 11
- Joined: Mon Jan 19, 2004 5:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi MikeTheLad,
This is not possible in ASP.NET applications as WebChart is rendered as an image on the client. To achieve what you request you can add two buttons on your WebForm and this code:
This is not possible in ASP.NET applications as WebChart is rendered as an image on the client. To achieve what you request you can add two buttons on your WebForm and this code:
Code: Select all
protected void Button1_Click(object sender, EventArgs e)
{
calendar1.PreviousMonth();
}
protected void Button2_Click(object sender, EventArgs e)
{
calendar1.NextMonth();
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 11
- Joined: Mon Jan 19, 2004 5:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi MikeTheLad,
This is because PreviousMonth and NextMonth move the Calendar series onto the month before and after the present one respectively.
To achieve what you request you should use Calendar.Date.AddMonth method and save the chart as a session variable as shown here:
Thanks, this works, but I can only goto the next month, ie September, if I then select again it does not goto October.
This is because PreviousMonth and NextMonth move the Calendar series onto the month before and after the present one respectively.
To achieve what you request you should use Calendar.Date.AddMonth method and save the chart as a session variable as shown here:
Code: Select all
private MemoryStream tmpChart;
protected void Page_Load(object sender, EventArgs e)
{
Steema.TeeChart.Chart ch1=WebChart1.Chart;
tmpChart=new MemoryStream();
if (Session["ch1"] == null)
{
//setup Chart
Steema.TeeChart.Styles.Calendar calendar1 = new Steema.TeeChart.Styles.Calendar(WebChart1.Chart);
calendar1.FillSampleValues();
SaveChart();
}
else
{
LoadChart();
}
}
private void LoadChart()
{
//retrieve the session stored Chart
tmpChart = (MemoryStream)Session["ch1"];
//set the Stream position to 0 as the last read/write
//will have moved the position to the end of the stream
tmpChart.Position = 0;
//import saved Chart
WebChart1.Chart.Import.Template.Load(tmpChart);
Steema.TeeChart.Styles.Calendar calendar1 = ((Steema.TeeChart.Styles.Calendar)WebChart1.Chart.Series[0]);
calendar1.Date = calendar1.Date.AddMonths(((int)Session["months"]));
}
private void SaveChart()
{
//export Chart to a MemoryStream template
WebChart1.Chart.Export.Template.Save(tmpChart);
//save template to a Session variable
Session.Add("ch1", tmpChart);
if (Session["months"] == null)
{
Session.Add("months", 0);
}
else
{
Session.Add("months", tmpMonths);
}
}
private int tmpMonths;
protected void Button1_Click(object sender, EventArgs e)
{
Steema.TeeChart.Styles.Calendar calendar1 = ((Steema.TeeChart.Styles.Calendar)WebChart1.Chart.Series[0]);
tmpMonths = ((int)Session["months"]) - 1;
calendar1.Date = calendar1.Date.AddMonths(-1);
SaveChart();
}
protected void Button2_Click(object sender, EventArgs e)
{
Steema.TeeChart.Styles.Calendar calendar1 = ((Steema.TeeChart.Styles.Calendar)WebChart1.Chart.Series[0]);
tmpMonths = ((int)Session["months"]) + 1;
calendar1.Date = calendar1.Date.AddMonths(1);
SaveChart();
}
Yes, you can use this:Also how do I find the year, to get the month I have:-
int currentmonth = calendar1.Month;
I need to know what the current month/year the calendar is currently on.
Code: Select all
int currMonth = calendar1.Date.Month;
int currYear = calendar1.Date.Year;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 11
- Joined: Mon Jan 19, 2004 5:00 am
thanks for this, this bit more complex than expected. If I put
Steema.TeeChart.Styles.Calendar calendar1 = new Steema.TeeChart.Styles.Calendar(WebChart1.Chart);
In the page load, it will not compile as unable to resolve calendar1 further down, if I put:-
Steema.TeeChart.Styles.Calendar calendar1 = new Steema.TeeChart.Styles.Calendar();
Before the page load and comment out the one in page load it will then compile, and load the calender, but I can't goto next month as get error on the LoadChart() on the line:-
Steema.TeeChart.Styles.Calendar calendar1 = ((Steema.TeeChart.Styles.Calendar)WebChart1.Chart.Series[0]);
Is this due the having the define the calendar1 differently before the page load.
Steema.TeeChart.Styles.Calendar calendar1 = new Steema.TeeChart.Styles.Calendar(WebChart1.Chart);
In the page load, it will not compile as unable to resolve calendar1 further down, if I put:-
Steema.TeeChart.Styles.Calendar calendar1 = new Steema.TeeChart.Styles.Calendar();
Before the page load and comment out the one in page load it will then compile, and load the calender, but I can't goto next month as get error on the LoadChart() on the line:-
Steema.TeeChart.Styles.Calendar calendar1 = ((Steema.TeeChart.Styles.Calendar)WebChart1.Chart.Series[0]);
Is this due the having the define the calendar1 differently before the page load.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi MikeTheLad,
Ok, then try adding the calendar series like this:
Hopefully this will solve your problems.
Ok, then try adding the calendar series like this:
Code: Select all
Steema.TeeChart.Styles.Calendar calendar1 = new Steema.TeeChart.Styles.Calendar();
WebChart1.Chart.Series.Add(calendar1);
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 11
- Joined: Mon Jan 19, 2004 5:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi MikeTheLad,
The code below builds successfully here using TeeChart for .NET v1. However it fails when loading the chart at WebChart1.Chart.Import.Template.Load(tmpChart);. Anyway, this code works fine here using TeeChart for .NET v3.
The code below builds successfully here using TeeChart for .NET v1. However it fails when loading the chart at WebChart1.Chart.Import.Template.Load(tmpChart);. Anyway, this code works fine here using TeeChart for .NET v3.
Code: Select all
private MemoryStream tmpChart;
protected void Page_Load(object sender, EventArgs e)
{
tmpChart = new MemoryStream();
if (Session["ch1"] == null)
{
//setup Chart
Steema.TeeChart.Styles.Calendar calendar1 = new Steema.TeeChart.Styles.Calendar();
WebChart1.Chart.Series.Add(calendar1);
calendar1.FillSampleValues();
SaveChart(0);
}
else
{
LoadChart();
}
}
private void LoadChart()
{
//retrieve the session stored Chart
tmpChart = (MemoryStream)Session["ch1"];
//set the Stream position to 0 as the last read/write
//will have moved the position to the end of the stream
tmpChart.Position = 0;
//import saved Chart
WebChart1.Chart.Import.Template.Load(tmpChart);
Steema.TeeChart.Styles.Calendar calendar1 = GetCalendarSeries();
calendar1.Date = calendar1.Date.AddMonths(GetMonths());
}
private Steema.TeeChart.Styles.Calendar GetCalendarSeries()
{
return ((Steema.TeeChart.Styles.Calendar)WebChart1.Chart.Series[0]);
}
private int GetMonths()
{
return (int)Session["months"];
}
private void SaveChart(int tmpMonths)
{
//export Chart to a MemoryStream template
WebChart1.Chart.Export.Template.Save(tmpChart);
//save template to a Session variable
Session.Add("ch1", tmpChart);
Session.Add("months", tmpMonths);
}
protected void Button1_Click(object sender, EventArgs e)
{
Steema.TeeChart.Styles.Calendar calendar1 = GetCalendarSeries();
calendar1.Date = calendar1.Date.AddMonths(-1);
SaveChart(GetMonths() - 1);
}
protected void Button2_Click(object sender, EventArgs e)
{
Steema.TeeChart.Styles.Calendar calendar1 = GetCalendarSeries();
calendar1.Date = calendar1.Date.AddMonths(1);
SaveChart(GetMonths() + 1);
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 11
- Joined: Mon Jan 19, 2004 5:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi MikeTheLad,
Please notice that TeeChart for .NET v2 was released back on June 2006 and on May 2007 v3 was published as well. So it's most unlikely that this is fixed now in v1.
Also please notice that later TeeChart for .NET versions include several enhancements as far as ASP.NET applications concerns, including much more interactivity, as you can see at the live ASP.NET demo.
Please notice that TeeChart for .NET v2 was released back on June 2006 and on May 2007 v3 was published as well. So it's most unlikely that this is fixed now in v1.
Also please notice that later TeeChart for .NET versions include several enhancements as far as ASP.NET applications concerns, including much more interactivity, as you can see at the live ASP.NET demo.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |