Using the WebChart component in a WebForms app:
MarkText set in a GetSeriesMark event handler is not saved by a call to Chart.Export.Template.Save() (or it is not loaded by a call to Chart.Import.Template.Load())
Template.Save/Load and GetSeriesMark
-
- Newbie
- Posts: 5
- Joined: Wed Jun 28, 2006 12:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dave,
Exporting TeeChart into a native file format or a stream doesn't save associated events. You'll need to assign the events again after having loaded the chart.
Exporting TeeChart into a native file format or a stream doesn't save associated events. You'll need to assign the events again after having loaded the chart.
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: 5
- Joined: Wed Jun 28, 2006 12:00 am
I tried the following code:narcis wrote:Hi Dave,
Exporting TeeChart into a native file format or a stream doesn't save associated events. You'll need to assign the events again after having loaded the chart.
chart.Import.Template.Load(tmpChart);
foreach(Steema.TeeChart.Styles.Series series in chart.Series)
{
if (series.Title == "tcsCritical")
series.GetSeriesMark += new Steema.TeeChart.Styles.Series.GetSeriesMarkEventHandler(this.tcsCritical_GetSeriesMark);
}
However, the code in the foreach loop is not executed because chart.Series.Count == 0
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dave,
Are you exporting the chart as in the example I posted here or the zooming example at the ASP.NET demo?
If the problem persists please send us a simple example project we can run "as-is" to reproduce the problem here.
You can post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Thanks in advance.
Are you exporting the chart as in the example I posted here or the zooming example at the ASP.NET demo?
If the problem persists please send us a simple example project we can run "as-is" to reproduce the problem here.
You can post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 5
- Joined: Wed Jun 28, 2006 12:00 am
Hi,
Thanks for your replies. I found the problem but I'm not sure why it makes a difference.
My original code:
Steema.TeeChart.Chart chart = chtPareto.Chart;
chart.Import.Template.Load(tmpParetoChart);
foreach(Steema.TeeChart.Styles.Series series in chart.Series)
{
...
}
By changing the foreach statement to reference chtPareto.Chart instead of the local variable, "chart" I got the application to work i.e:
foreach(Steema.TeeChart.Styles.Series series in chtPareto.Chart.Series)
Thanks for your replies. I found the problem but I'm not sure why it makes a difference.
My original code:
Steema.TeeChart.Chart chart = chtPareto.Chart;
chart.Import.Template.Load(tmpParetoChart);
foreach(Steema.TeeChart.Styles.Series series in chart.Series)
{
...
}
By changing the foreach statement to reference chtPareto.Chart instead of the local variable, "chart" I got the application to work i.e:
foreach(Steema.TeeChart.Styles.Series series in chtPareto.Chart.Series)
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dave,
If chart variable is visible or declared in the same method as the foreach statement then I don't see why it shouldn't work.
If chart variable is visible or declared in the same method as the foreach statement then I don't see why it shouldn't work.
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: 5
- Joined: Wed Jun 28, 2006 12:00 am
I can break your example code, too, by changing the LoadChart() method as follows:narcis wrote:Hi Dave,
If chart variable is visible or declared in the same method as the foreach statement then I don't see why it shouldn't work.
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
Steema.TeeChart.Chart chart = webChart1.Chart;
chart.Import.Template.Load(tmpChart);
Steema.TeeChart.Styles.Calendar calendar1 = ((Steema.TeeChart.Styles.Calendar)chart.Series[0]);
calendar1.Date = calendar1.Date.AddMonths(((int)Session["months"]));
}
This throws a System.ArgumentOutOfRangeException when trying to access chart.Series[0]
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dave,
If you are using TeeChart for .NET v3 then you should use this:
If you are using TeeChart for .NET v3 then you should use this:
Code: Select all
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
Steema.TeeChart.Chart chart = WebChart1.Chart;
chart = chart.Import.Template.Load(tmpChart);
Steema.TeeChart.Styles.Calendar calendar1 = ((Steema.TeeChart.Styles.Calendar)chart.Series[0]);
calendar1.Date = calendar1.Date.AddMonths(((int)Session["months"]));
}
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 |