AnyChart Preloader SWF

Overview

Preloader swf is a special SWF file that makes loading AnyChart SWF more comfortable with a slow Internet Connection and provides some useful customization settings.

In this tutorial we will show how to use and configure the preloader.

to top

Using Preloader

The best way to implement the preloader is to utilize AnyChart(swf, preloader) constructor from AnyChart JavaScript Integration Library. The code in JS Script should look like that:

<script type="text/javascript" language="javascript">
//<![CDATA[
var chart = new AnyChart('./swf/AnyChart.swf', './swf/preloader.swf');
chart.width = 600;
chart.height = 300;
chart.messages = {
loadingConfig: "Custom loading config text...",
waitingForData: "Custom waiting for data text..."}
chart.setXMLFile('./data.xml');
chart.write();
//]]>
</script>

You can use preloader swf with simple HTML embedding like that:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
width="600" height="300">
<param name="movie" value="swf/preloader.swf" />
<param name="flashvars"
value="XMLFile=data1.xml&swffile=./swf/AnyChart.swf&loadingConfig=Custom%20loading..." />
<embed
type="application/x-shockwave-flash"
src="swf/preloader.swf"
flashvars="XMLFile=data1.xml&swffile=./swf/AnyChart.swf&loadingConfig=Custom%20loading..."
width="600" height="300">
</embed>
</object>

Launch the preloader sample - it demonstrates both JS and HTML embedding - you can see the percents showing swf loading state (if you will place this sample on the web site and open a page with using slow Internet connection channel).

Download the sample sample: Preloader Sample.

to top

Preloader Features

You can customize text to show in preloader and while AnyChart initializes. You can configure the following texts:

Parameter
(flashvar or messages object fields)

Description
preloaderInit Text to be shown on preloader initialization (if preloader is used).
Default: ""
preloaderLoading Text to be shown while AnyChart is loading AnyChart.swf
Default: "Loading... "
init Text to be shown while AnyChart is initializing
Default: "Initializing..."
loadingConfig Text to be shown while AnyChart is loading config data.
Default: "Loading config..."
loadingResources Text to be shown while AnyChart is loading resources (images, etc.)
Default: "Loading resources..."
noData Text to be shown when AnyChart gets chart without data.
Default: "No Data"
waitingForData

Text to be shown when AnyChart gets no data source (neither config file nor config string is set to chart).
Default: "Waiting for data..."

loadingTemplates Text to be shown while AnyChart is loading chart templates
Default: ""Loading templates...""

To set your own initialization strings you can use AnyChart JavaScript Library properties or preloader and AnyChart SWF parameters.

In preloader sample we've set custom texts - messages are customized. You should use URL Encode if you want to use non-latin or non-alphanumeric symbols.

to top