deserialize method

  1. @override
void deserialize(
  1. XmlElement xml
)
override

Deserializes the FML template elements, attributes and children

Implementation

@override
void deserialize(XmlElement xml) {
  //* Deserialize */
  super.deserialize(xml);

  // properties
  x = Xml.get(node: xml, tag: 'x');
  y = Xml.get(node: xml, tag: 'y');
  color = Xml.get(node: xml, tag: 'color');
  stroke = Xml.get(node: xml, tag: 'stroke');
  radius = Xml.get(node: xml, tag: 'radius');
  size = Xml.get(node: xml, tag: 'size');
  type = Xml.get(node: xml, tag: 'type');
  label = Xml.get(node: xml, tag: 'label');
  tooltips = Xml.get(node: xml, tag: 'tooltips');
  animated = Xml.get(node: xml, tag: 'animated');
  name = Xml.get(node: xml, tag: 'name');
  group = Xml.get(node: xml, tag: 'group');
  stack = Xml.get(node: xml, tag: 'stack');
  showarea = Xml.get(node: xml, tag: 'showarea');
  showline = Xml.get(node: xml, tag: 'showline');
  showpoints = Xml.get(node: xml, tag: 'showpoints');

  // Remove datasource listener. The parent chart will take care of this.
  if ((datasource != null) &&
      (scope != null) &&
      (scope!.datasources.containsKey(datasource))) {
    scope!.datasources[datasource!]!.remove(this);
  }

  // Setup the Series type and some internal properties for supporting it
  if (type != null) type = type?.trim().toLowerCase();
  switch (toEnum(type, ChartSeriesType.values)) {
    case ChartSeriesType.area:
      type = fromEnum(ChartSeriesType.area);
      break;

    case ChartSeriesType.bar:
      type = fromEnum(ChartSeriesType.bar);
      break;

    case ChartSeriesType.label:
      type = fromEnum(ChartSeriesType.label);
      break;

    case ChartSeriesType.line:
      type = fromEnum(ChartSeriesType.line);
      break;

    case ChartSeriesType.pie:
      type = fromEnum(ChartSeriesType.pie);
      break;

    case ChartSeriesType.plot:
      type = fromEnum(ChartSeriesType.plot);
      break;

    case ChartSeriesType.waterfall:
      type = fromEnum(ChartSeriesType.waterfall);
      break;

    default:
      Log().warning('Unknown ChartSeriesType: $type');
      break;
  }
}