API Reference
Still have questions?
Contact support

namespace anychart.utils Improve this Doc

Functions Overview

hideTooltips()Hide all tooltips.
htmlTableFromCsv()Creates HTML Table from CSV string.
json2xml()Converts JSON object to an XML Node tree or String (string by default).
xml2json()Public function that parses XML and returns JSON. It hides all errors in

Typedefs Overview

anychart.utils.RectObjType definition for the rectangle.

Functions Description


Hide all tooltips.


Name Type Description
force boolean Ignore tooltips hide delay.


Creates HTML Table from CSV string.


Name Type Description
csv string CSV string.
title string Title to set.
asString boolean Defines output: HTML string if True, DOM element if False.
csvSettings Object CSV settings.


Element - HTML table instance, HTML string or null if parsing CSV to table fails.


Converts JSON object to an XML Node tree or String (string by default).


Name Type Description
json Object | string
rootNodeName string
returnAsXmlNode boolean


string Node -


Public function that parses XML and returns JSON. It hides all errors in Document structure, so the result may be not as strict as expected. The function converts XML string or node to an object with attributes introduced as same named string properties. All subnodes are also converted to correspondingly named properties by the next rules: - if there is only one child with this name, it is converted into an object an added just as an object property to the parent object. - if there are multiple children with the same name, they are also converted to a separate objects and then added to the parent object as an array. - if there is an attribute named just like the node(s), the node(s) will completely replace the attribute. - if there is any text value or a CDATA node or any their combination in the node, that value is stored as a string in a property named "value" even in cases when there is a subnode named "value" (but the node with this name still can be found in "#children#" array mentioned below). Also some service properties are added to an object representing a node: - "#name#" property - the node name - "#children#" array property - all node children listed in order they appear in the node - mentioned above "value" string property - contains textual value of the node Usage sample: var a = new XMLHttpRequest();'GET', '', false, "", ""); a.send(null); // for example there was the next XML: // // // some text value // // var json = anychart.utils.XML2JSON(a.responseXML); json variable will have the following structure: { #name#: "root", #children#: [ {#name#: "child", #children#: []}, {#name#: "child", #children#: [], value: "some text value and a CDATA "} {#name#: "child_other", #children#: []} ], a: "123", child: [ {#name#: "child", #children#: []}, {#name#: "child", #children#: [], value: "some text value and a CDATA "} ], child_other: {#name#: "child_other", #children#: []} }


Name Type Description
xml string | Node XML source string.


Object string - Transformation result JSON (may by null).