LoadFromXml(Value: String);
LoadFromXml(Value: System.String);
Value. Visualizator parameters in XML format.
The LoadFromXml method loads XML parameters of visualizer: style and data.
Executing the example requires that the repository contains an express report with the EXPRESS identifier. Add links to the Express, Metabase, Visualizators, Xml system assemblies.
Before executing the example the bubble tree looks as shown on the IVZBubbleTree interface description page. Get style parameters in XML format for the bubble tree, change the color of labels that are outside the bubbles:
Public Sub UserProc;
Var
Metabase: IMetabase; // Metabase
EaxAnalyzer: IEaxAnalyzer; // Express report
BubbleTree: IVZBubbleTree; // Bubble tree
BubbleTreeXML: String; // Style settings in XML format
//To work with XML structure
XMLDoc: IXMLDOMDocument;
Loaded: Boolean;
Nodes: IXmlDomNodeList;
Node, NodeAttr: IXmlDomNode;
Begin
// Get metabase object
Metabase := MetabaseClass.Active;
// Get express report object
EaxAnalyzer := Metabase.ItemById("EXPRESS").Edit As IEaxAnalyzer;
// Get bubble tree
BubbleTree := EaxAnalyzer.BubbleTree.BubbleTree;
// Get bubble tree parameters in XML format
BubbleTreeXML := BubbleTree.SaveToXml;
// Create a structure to change XML
XMLDoc := New DOMDocument.Create;
Loaded := XMLDoc.loadXML(BubbleTreeXML);
If Loaded Then
// Get the Font node
Nodes := XMLDOc.getElementsByTagName("Font");
Node := Nodes.item(1);
// Search for the Color attribute
NodeAttr := Node.attributes.getNamedItem("Color");
// Set other color
NodeAttr.nodeValue := "#FF404EED";
// Get changed XML
BubbleTreeXML := XMLDoc.xml;
End If;
// Set new values of bubble tree style parameters from XML
BubbleTree.LoadFromXml(BubbleTreeXML);
// Save express report
(EaxAnalyzer As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the color of the labels that are outside the bubble is changed for blue.
The requirements and result of the Fore.NET example execution match with those in the Fore example. It is necessary to connect MXml2 instead of the Xml assembly.
Public Shared Sub Main(Params: StartParams);
Var
Metabase: IMetabase; // Metabase
EaxAnalyzer: IEaxAnalyzer; // Express report
BubbleTree: IVZBubbleTree; // Bubble tree
BubbleTreeXML: String; // Style settings in XML format
//To work with XML structure
XMLDoc: IXMLDOMDocument;
Loaded: Boolean;
Nodes: IXmlDomNodeList;
Node, NodeAttr: IXmlDomNode;
Begin
// Get metabase object
Metabase := Params.Metabase;
// Get express report object
EaxAnalyzer := Metabase.ItemById["CLEAR24"].Edit() As IEaxAnalyzer;
// Get bubble tree
BubbleTree := EaxAnalyzer.BubbleTree.BubbleTree;
// Get bubble tree parameters in XML format
BubbleTreeXML := BubbleTree.SaveToXml();
// Create a structure to change XML
XMLDoc := New DOMDocument.Create();
Loaded := XMLDoc.loadXML(BubbleTreeXML);
If Loaded Then
// Get the Font node
Nodes := XMLDOc.getElementsByTagName("Font");
Node := Nodes.item[1];
// Search for the Color attribute
NodeAttr := Node.attributes.getNamedItem("Color");
// Set other color
NodeAttr.nodeValue := "#FF404EED";
// Get changed XML
BubbleTreeXML := XMLDoc.xml;
End If;
// Set new values of bubble tree style parameters from XML
BubbleTree.LoadFromXml(BubbleTreeXML);
// Save express report
(EaxAnalyzer As IMetabaseObject).Save();
End Sub;
See also: