Cannot load exported chart
Cannot load exported chart
I have exported one chart but know I cannot load it with this instruction "Import.Template.Load"
In the error message it says "{"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"}" but how can I know better where is the problem?
this is the exported chart
http://193.145.251.126/pnp/files/hsYpWInRr/test2.ten
Thanks
In the error message it says "{"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"}" but how can I know better where is the problem?
this is the exported chart
http://193.145.251.126/pnp/files/hsYpWInRr/test2.ten
Thanks
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Cannot load exported chart
Hello,
The problem is due to a custom axis. A custom axis is deserialized but is not being correctly placed into the custom axes collection (Axis.Custom), hence the error. I'm not sure why this is occurring, as otherwise custom axes serialize without a problem, e.g.wakeup wrote: but how can I know better where is the problem?
Code: Select all
private void InitializeChart()
{
Line line = new Line(tChart1.Chart);
line.FillSampleValues();
Axis axis = new Axis(tChart1.Chart);
tChart1.Axes.Custom.Add(axis);
axis.Horizontal = false;
axis.RelativePosition = 30;
line.CustomVertAxis = axis;
}
private void button1_Click(object sender, EventArgs e)
{
MemoryStream stream = new MemoryStream();
tChart1.Export.Template.Save(stream);
tChart1.Clear();
MessageBox.Show("Clear");
stream.Position = 0;
tChart1.Import.Template.Load(stream);
}
Best Regards,
Christopher Ireland / 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 |
Re: Cannot load exported chart
Thanks, yes I'm working with custom axis and I can serialize and deserialize without problems except in that case, is not possible to see what it have in special?
Thanks
Thanks
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Cannot load exported chart
It looks as if the series in your *.ten file have CustomVertAxis assigned, but that these axis objects are not present in the tChart1.Axes.Custom collection - are you quite sure you are adding them in? It would be interesting to see the code that produced that *.ten file.wakeup wrote: Thanks, yes I'm working with custom axis and I can serialize and deserialize without problems except in that case, is not possible to see what it have in special?
Best Regards,
Christopher Ireland / 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 |
Re: Cannot load exported chart
This is the code I have to create the custom axis for each serie
is there something wrong?
Thanks
Code: Select all
for (int i = 0; i < chart.Series.Count; i++)
{
Steema.TeeChart.Axis customAxis = new Steema.TeeChart.Axis(chart.Chart);
customAxis.Title.Caption = txtTitle.Text;
customAxis.Visible = false;
customAxis.Automatic = !manualScale;
if (manualScale)
{
customAxis.Maximum = variables[i].maxScale.Value;
customAxis.Minimum = variables[i].minScale.Value;
}
chart.Axes.Custom.Add(customAxis);
chart.Series[i].CustomVertAxis = customAxis;
}
Thanks
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Cannot load exported chart
Not that I can see, no. The following code works fine here:wakeup wrote: is there something wrong?
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
for (int i = 0; i < 3; i++)
{
tChart1.Series.Add(typeof(Line)).FillSampleValues();
Steema.TeeChart.Axis customAxis = new Steema.TeeChart.Axis(tChart1.Chart);
customAxis.Title.Caption = "hello";
customAxis.RelativePosition = (i + 1) * 10;
customAxis.Visible = false;
tChart1.Axes.Custom.Add(customAxis);
tChart1.Series[i].CustomVertAxis = customAxis;
}
}
private void button1_Click(object sender, EventArgs e)
{
MemoryStream stream = new MemoryStream();
tChart1.Export.Template.Save(stream);
tChart1.Clear();
MessageBox.Show("Clear");
stream.Position = 0;
tChart1.Import.Template.Load(stream);
}
Best Regards,
Christopher Ireland / 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 |
Re: Cannot load exported chart
I have aparrently the same error again but I think in this chart there arent custom axes.
Could you test it?
http://193.145.251.126/pnp/files/XfyapMBif/test3.ten
Is not possible to check in my own what is exactly wrong?
Thanks
Could you test it?
http://193.145.251.126/pnp/files/XfyapMBif/test3.ten
Is not possible to check in my own what is exactly wrong?
Thanks
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Cannot load exported chart
Of course I will test it, but unfortunately test3.ten doesn't seem to be at this URL. Could you please check it for me?wakeup wrote:Could you test it?
http://193.145.251.126/pnp/files/XfyapMBif/test3.ten
Best Regards,
Christopher Ireland / 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 |
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Cannot load exported chart
It is a custom axes which is again causing this failure. Could you please give me a code snippet which produces this *.ten file and with which I can recreate it here?wakeup wrote:Sorry, try this.
http://193.145.251.126/pnp/files/FKzuOqZQJ/test3.ten
Best Regards,
Christopher Ireland / 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 |
Re: Cannot load exported chart
Here it is, althought I guess it is very simple...
Thanks
Code: Select all
chart.Export.Template.IncludeData = includeData;
chart.Export.Template.Save(path);
Thanks
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Cannot load exported chart
Sorry, but I am unable to reproduce the test3.ten using only the above two lines of code. Would you be so kind as to give me a fuller snippet with which I can recreate the test3.ten file in its entirety?wakeup wrote:Here it is, althought I guess it is very simple...Code: Select all
chart.Export.Template.IncludeData = includeData; chart.Export.Template.Save(path);
Thanks
Best Regards,
Christopher Ireland / 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 |
Re: Cannot load exported chart
It's dificult, it's a big project which sets a lot of properties of teechart in different parts of the code.
In this post there is the code of creating the custom axis which are causing this failure. If you want the code of some other specific task I can send you but all the project is difficult...
Thanks
In this post there is the code of creating the custom axis which are causing this failure. If you want the code of some other specific task I can send you but all the project is difficult...
Thanks
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Cannot load exported chart
Where is this code? As I mentioned, the following code works correctly here:wakeup wrote: In this post there is the code of creating the custom axis which are causing this failure.
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
for (int i = 0; i < 3; i++)
{
tChart1.Series.Add(typeof(Line)).FillSampleValues();
Steema.TeeChart.Axis customAxis = new Steema.TeeChart.Axis(tChart1.Chart);
customAxis.Title.Caption = "hello";
customAxis.RelativePosition = (i + 1) * 10;
customAxis.Visible = false;
tChart1.Axes.Custom.Add(customAxis);
tChart1.Series[i].CustomVertAxis = customAxis;
}
}
private void button1_Click(object sender, EventArgs e)
{
MemoryStream stream = new MemoryStream();
tChart1.Export.Template.Save(stream);
tChart1.Clear();
MessageBox.Show("Clear");
stream.Position = 0;
tChart1.Import.Template.Load(stream);
}
Best Regards,
Christopher Ireland / 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 |
Re: Cannot load exported chart
Here is the code
http://www.teechart.net/support/viewtop ... 410#p64410
Yest that code works, and my code most of the times also works, but sometimes not and that is what I'm try to know why...
http://www.teechart.net/support/viewtop ... 410#p64410
Yest that code works, and my code most of the times also works, but sometimes not and that is what I'm try to know why...