Page 1 of 1

Import and Export

Posted: Fri Apr 25, 2008 5:34 pm
by 13045128
I seem to be having some problems importing templates as well as XML files. The files are uploaded to you can you review and comment on what I am missing.

Posted: Mon Apr 28, 2008 10:15 am
by narcis
Hi history,

The problem seems related to the fact that each series first value is -Infinity. This is a defect that I've added to the bug list (TF02013018) to be fixed for next releases.

Posted: Tue Apr 29, 2008 4:47 pm
by 9642161
I changes the template to not export the data and tried to import the new template without data and had the same issue. I will upload the template without data.

Posted: Wed Apr 30, 2008 8:43 am
by narcis
Hi histry,

Thanks for the file and information. I could reproduce the issue here, debugged it and found the error happens when the template file loads an object of type Honeywell.Desktop.OfficeInterface.TrendRectangleTool. Is that a custom object you created? If so you may be interested in reading this thread about custom objects serialization/deserialization and also read Tutorial19 - Custom Serialization.

Posted: Wed Apr 30, 2008 12:04 pm
by 9642161
Thanks

yes, I will take a look


Thanks

Posted: Tue May 27, 2008 8:03 am
by narcis
Hi histry,

We are currently investigating TF02013018 and we are wondering how did you create the xml file? In the file, all series begin and end with a double.NegativeInfinity. This means the file can't have been generated from TeeChart, as the following code does not work:

Code: Select all

    private void InitializeChart()
    {
      tChart1.Series.Add(typeof(Line));
      tChart1[0].Add(1, double.NegativeInfinity);
      tChart1[0].Add(2, 2);
      tChart1[0].Add(3, 3);
      tChart1[0].Add(4, double.NegativeInfinity);
    }
So could you please send us the code you used to generate the chart that generated the XML file?

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Posted: Tue May 27, 2008 12:10 pm
by 9642161
not sure what you are asking.

The data is created outside Teechart and series are populated as follows

double?[] timestamps;
double?[] dataValues;
...
...
dataPoints.Add(timestamps, dataValues);


The XML file is created from the series data within Teechart using the Export command.

Posted: Tue May 27, 2008 1:30 pm
by Chris
Hello,
histry wrote:not sure what you are asking.
Well, I guess it's really to confirm that the problem can be represented in this code:

Code: Select all

   public Form3()
    {
      InitializeComponent();
      InitializeChart();
    }

    private void InitializeChart()
    {
      tChart1.Series.Add(typeof(Line));
      tChart1[0].DefaultNullValue = double.NegativeInfinity;
      tChart1[0].Add(1, double.NegativeInfinity, Color.Transparent);
      tChart1[0].Add(2, 2);
      tChart1[0].Add(3, 3);
      tChart1[0].Add(4, double.NegativeInfinity, Color.Transparent);
    }

    private void button1_Click(object sender, EventArgs e)
    {
      tChart1.Export.Data.XML.Save(@"C:\temp\inf.xml");
    }

    private void button2_Click(object sender, EventArgs e)
    {
      tChart1.Clear();
      XmlSource source = new XmlSource(tChart1.Chart);
      source.Load(@"C:\temp\inf.xml");
    }
When an error is thrown on clicking button2, that is, trying to import the TeeChart generated file. Can you please give us an indication that your case is similar to the one above?

Posted: Tue May 27, 2008 3:02 pm
by Chris
Hello,
Chris wrote:Can you please give us an indication that your case is similar to the one above?
Ok, the code posted in my last message in this thread has now been fixed. The inf.xml generated looks like this:

Code: Select all

<chart>
 <series title="line1" type="Line" color="FF4466A3">
  <points count="4">
<point color="00FFFFFF" X="1" Y="-Infinity"/>
<point X="2" Y="2"/>
<point X="3" Y="3"/>
<point color="00FFFFFF" X="4" Y="-Infinity"/>
  </points>
 </series>
</chart>
Please note that the format of this file is different from your stripchart.xml, hence my reason for asking if that file was generated in a way similar to my code. The important difference is in the <point color attribute which specifies the null value (Color.Transparent in Hex). Simply importing in your stripchart.xml even with this fix in place will still produce an error.