Hello,
My name is Tony. I hope somebody can help me. Many thanks in advance!
I have a Project (Visual Studio 2012) with TChart v.2018. When I try to serialize and deserialize a Gauge to save it and open I receive an error.
This is the way I'm doing it:
- To save:
public void nativeSerialize(Steema.TeeChart.TChart chart, bool includeData)
{
// Guardar archivo a carpeta temporal
string path = System.IO.Path.GetTempPath() + @"\temp" + System.DateTime.Now.Millisecond.ToString() + ".ten";
chart.Export.Template.IncludeData = includeData;
chart.Export.Template.Save(path);
byte[] buff = null;
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
BinaryReader stream = new BinaryReader(fs);
int LengthOfBuffer = (int)fs.Length;
// the buffer for contents of the file
buff = new byte[LengthOfBuffer];
// read the file into the buffer
for (int i = 0; i < LengthOfBuffer; i++)
buff = stream.ReadByte();
// close the file
stream.Close();
fs.Close();
this.native = Convert.ToBase64String(buff);
File.Delete(path);
}
- To open:
public void nativeDeSerialize(Steema.TeeChart.TChart chart)
{
byte[] buff2 = Convert.FromBase64String(this.native);
string path = System.IO.Path.GetTempPath() + @"\temp" + System.DateTime.Now.Millisecond.ToString() + ".ten";
FileStream fsOut = new FileStream(path, FileMode.Create, FileAccess.Write);
BinaryWriter streamOut = new BinaryWriter(fsOut);
streamOut.Write(buff2);
streamOut.Close();
fsOut.Close();
chart.Import.Template.Load(path); << here I get the error (*)
File.Delete(path);
}
(*) Error: {"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"}
This way is the same I do with another types of Graphs (histogram, for example) and I have no problems. And also, I don't receive any error if I use an older versión of TChart (2014)
If you need any more details or information, please tell me.
Thanks,
Tony
Problems to open a Gauge (csharp .net)
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Problems to open a Gauge (csharp .net)
Hello Tony,
using the following code and the latest TeeChart.NET Pro assembly available from Nuget here (v.4.2018.10.27), CircularGauge template exportation and importation work as expected:
Could you please retouch the above example so I can reproduce your issue here?
using the following code and the latest TeeChart.NET Pro assembly available from Nuget here (v.4.2018.10.27), CircularGauge template exportation and importation work as expected:
Code: Select all
public Form1()
{
InitializeComponent();
tChart1.Series.Add(typeof(CircularGauge)).FillSampleValues();
}
private void button1_Click(object sender, EventArgs e)
{
MemoryStream ms = new MemoryStream();
tChart1.Export.Template.IncludeData = true;
tChart1.Export.Template.Save(ms);
ms.Position = 0;
tChart2.Import.Template.Load(ms);
}
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: Problems to open a Gauge (csharp .net)
Hello,
And many thanks.
I have downloaded the nuget package and now is running. But, now a watermark is showing in my charts "This is an EVALUATION versión...."
I have tried to activate the license following the steps in Steema web, but I am afraid I am doing something wrong because it doesnt work
Last thing I have done is to search for the "Steema_License.zip" file, but I cant find it anywhere in my PC. Where is it supposed to be?
Thanks again. Best regards,
Tony
And many thanks.
I have downloaded the nuget package and now is running. But, now a watermark is showing in my charts "This is an EVALUATION versión...."
I have tried to activate the license following the steps in Steema web, but I am afraid I am doing something wrong because it doesnt work
Last thing I have done is to search for the "Steema_License.zip" file, but I cant find it anywhere in my PC. Where is it supposed to be?
Thanks again. Best regards,
Tony
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Problems to open a Gauge (csharp .net)
Hello Tony,
if you have a valid license for TeeChart.NET Pro then you can write to sales@steema.com and they will be happy to give you the necessary Steema_License.zip. If you don't have a valid license then they will be happy to provide you with one!
if you have a valid license for TeeChart.NET Pro then you can write to sales@steema.com and they will be happy to give you the necessary Steema_License.zip. If you don't have a valid license then they will be happy to provide you with one!
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: Problems to open a Gauge (csharp .net)
Thank you very much!!
It is working now...
Best regards,
Tony
It is working now...
Best regards,
Tony