SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

0
0

How do I serialize custom annotation, as I am not able to serialize using Annotation collection as it only serializes the iAnnotation properties and not extended properties like TEXT.

Version
sciChart 4.x
  • You must to post comments
0
0

Hello Selva Arun,

all annotations including CustomAnnotations are derived from AnnotationBase which implemets an IXmlSerializable interface methods like WriteXml() and ReadXml() all you have to do is to override those methods in your CustomAnnotation

public class MyExtendedCustomAnnotation : CustomAnnotation
{
    public override void WriteXml(XmlWriter writer)
    {
        base.WriteXml(writer);
    }

    public override void ReadXml(XmlReader reader)
    {
        base.ReadXml(reader);
    }
}

Best Regards,
Pelyushkevych Nazariy
SciChart Wpf\Xamarin developer

  • You must to post comments
0
0

Do I need to add the extended properties in the above extended class? It still doesn’t serialise.

I set the type of CustomAnnotation to this extendedtype.

Please let me know. What else do I need to do?

  • You must to post comments
0
0

Hello Selva Arun

1) ” I set the type of CustomAnnotation to this extendedtype” you mean this MyExtendedCustomAnnotation ? it’s just a name
2) “Do I need to add the extended properties in the above extended class? It still doesn’t serialise.” — if you use Custom annotation and have there your custom properties you have to serialize them manually by yourself. This means you have to convert your properties to string and write it to your writer, something like this ===>>> writer.WriteAttributeString(propertyName, value); and then just read it like

var value = reader[propertyName];

3) If you still have problems with that serialization, you can create a sample app and attach it here, and probably i’ll try to find solution for you.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.