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 */
  /////////////////
  selected        = Xml.get(node: xml, tag: 'selected');
  animated        = Xml.get(node: xml, tag: 'animated');
  horizontal      = Xml.get(node: xml, tag: 'horizontal');
  showlegend      = Xml.get(node: xml, tag: 'showlegend');
  type            = Xml.get(node: xml, tag: 'type');

  // Get Series
  this.series.clear();
  List<ChartSeriesModel> series = findChildrenOfExactType(ChartSeriesModel).cast<ChartSeriesModel>();
    series.forEach((model)
    {
      // add the series to the list
      this.series.add(model);

      // register listener to the datasource
      IDataSource? source = (scope != null) ? scope!.getDataSource(model.datasource) : null;
      if (source != null) source.register(this);
    });

  // Get Axis
  List<ChartAxisModel> axis = findChildrenOfExactType(ChartAxisModel).cast<ChartAxisModel>();
  axis.forEach((axis)
  {
    if (axis.axis == ChartAxis.X) this.xaxis = axis;
    if (axis.axis == ChartAxis.Y) this.yaxis = axis;
  });
}