DHTMLX Docs & Samples Explorer

Serializing Chart

There are two ways to serialize chart data:

#1 - use a built-in Ajax serialization method:

At first, set the server-side saving script name, then call saveData, passing the desired file name for this chart to be saved into. The file name is passed to server as “filename” field, xml content is passed in “data” field.

We have provided a sample PHP and Perl scripts to save chart data on server. You may create the same kind of script pretty easy using any other server-side technology, like ASP.Net or Java.

<script>
        gantt.setSavePath("php/saveXML.php");
        gantt.saveData("chart1.xml");
</script>

#2 - read XML content and serialize it with your own Ajax code:

<script>
        var xmlString = gantt.getXML();
	// save this string with your own code
	...
</script>