Table of Contents

Function list

Functions that control the chart

flashMovie.setData(data)

This function can be used for setting the chart's data on the fly. Data must be in CSV form. Note, that this will work properly if you do not compare data sets, as only currently selected data set will receive this data.


flashMovie.appendData(data[,remove_count])

This function can be used to append new data to the currently selected dataset. This is extremely useful when your dataset is quite big and you add a few values every period, and don't want to reload the whole dataset. The data must be in CSV. The remove_count variable is optional and sets the number of data points that should be removed from the beginning of dataset.


flashMovie.setSettings(settings[,rebuild],reset_selected)

This function can be used to set multiple (or a single) setting at a runtime. The settings must be passed in XML form, using the same names as in settings file. The settings string must not contain line breaks, double quotes must be replaced with single quotes. For example:

flashMovie.setSettings("<settings><background><color>#CC0000</color><alpha>100</alpha></background></settings>");

The "rebuild" option might be "true" or "false" (the default is "true"). If you set it to "false", then the settings will not be applied until you call another new JS function: flashMovie.rebuild() or pass another set of settings with the "rebuild" set to "true".

The "reset_selected" option resets the selected settings to their initial state after this function runs. If this is not used, the settings remain in their changed state.

Note, if you want to change some existing settings of the settings items which can be multiple, such as <data_set>, <chart>, <graph>, you must add an ID for these settings both in your main setting and when passing them with this function. The id is formed out of the first letter of a setting name and the "id", for example:

<chart cid="0"> or <data_set did="1"> or <graph gid="2">


flashMovie.getSettings()

This function will ask Flash to return the whole settings XML. When you call this function to return the data, Flash will call the amReturnSettings(chart_id, settings) function.


flashMovie.rebuild()

This function will rebuild the chart. If you set some settings using setSettings() function, with the "rebuild" set to "false", then you can use this function to redraw the chart after several portions of settings were set.


flashMovie.reloadData()

This function will reload the data.


flashMovie.reloadSettings([file_name])

This function will reload the settings. The file_name variable is optional, if you do not set it here, settings from the original file will be reloaded. You can set a new settings file every time you call this function.


flashMovie.setEvents(events, [remove_old])

This function allows to add events at runtime. Use default event XML syntax: <events><event>….</event></events>. If you set the remove_old to true, the old events will be removed. Default value is "false".

flashMovie.setEvents("<events><event><date>2008-04-24</date><letter>A</letter><description><![CDATA[Price of Antarctica had a headache]]></description></event><event><date>2008-03-24</date><letter>B</letter><description><![CDATA[It was the hottest day of Spring]]></description></event></events>");

flashMovie.setTrendLines(trend_lines, [remove_old])

This function allows adding trend lines at a runtime. Use default trend line XML syntax: <trend_lines><trend_line>….</trend_line></trend_lines>. If you set the remove_old to true, the old trend_lines will be removed. Default value is "false".

flashMovie.setTrendLines("<trend_lines><trend_line><date0>2008-03-10</date0><date1>2008-04-11</date1><value0>119.69</value0><value1>147.14</value1><axis>right</axis></trend_line></trend_lines>");

flashMovie.setParam(param, value)

This function lets you change a single setting. The parameter names are formed using the section name and the parameter name, separated with a period. For example, the background opacity setting is:

<background>
  <alpha></alpha>

The parameter name will be: background.alpha

As there may be more than one data_set, chart or graph, you should add its sequential number in square brackets (counting from 0), for example:

data_sets.data_set[0].title

It is recommended to use setSettings(settings) function instead of setParam function since v 1.6.0.0


flashMovie.getParam(param)

This function will ask Flash to return the value of a setting. The parameter name is formed in the same way as the setParam function (described above). When you call this function to return the setting value, Flash will call the amReturnParam(chart_id, param) function.


flashMovie.getData()

This function will ask Flash to return the whole data. When you call this function to return the data, Flash will call the amReturnData(chart_id, data) function.


flashMovie.exportImage([file_name])

This function will start the process of exporting the chart as an image. The file_name is a name of a file to which image data will be posted (files provided in the download package are export.php and export.aspx). The file_name is optional and can be set in the <export_as_image><file> setting.


flashMovie.print()

This function will print the chart. Use this print function if you don't have any values rotated by 90 degrees, also if you don't have a custom bitmap background.


flashMovie.printAsBitmap()

Another print function. Use it if you have values rotated by 90 degrees and/or a custom bitmap background.


flashMovie.setZoom(from, to)

This function will change the selected period. "From" and "to" values must use date format, specified in <data_set><csv><date_format>.


flashMovie.showAll()

This function will show the full chart if some shorter period was previously selected.


flashMovie.selectDataSet(index)

This function will select a data set as main. The index here is the order number (as they go in settings file) of the data set.


flashMovie.compareDataSet(index)

This function will select a data set for comparing. The index here is the order number (as they go in settings file) of the data set.


flashMovie.uncompareDataSet(index)

This function will unselect a data set which was selected for comparing. The index here is the order number (as they go in settings file) of the data set.


flashMovie.uncompareAll()

This function will unselect all data set selected for comparing.


flashMovie.hideEvents()

This function will hide event bullets.


flashMovie.showEvents()

This function will show the hidden event bullets.


flashMovie.hideTrendLines()

This function will hide trend lines.


flashMovie.showTrendLines()

This function will show the hidden trend lines.


flashMovie.removeDataSet(did)

This function will remove the data set.


flashMovie.removeChart(cid)

This function will remove the chart.


flashMovie.removeGraph(cid, gid)

This function will remove the graph from the chart.


flashMovie.hideGraph(cid, gid)

This function will hide graph.


flashMovie.showGraph(cid, gid)

This function will show the hidden graph.


flashMovie.getStatus()

This function will ask chart to return the status (selected period, main and comparing data sets). The chart will call amGetStatus(chart_id, status) function.


flashMovie.setStatus(status)

This function will set the status (selected period, main and comparing data sets). Status example: from=2008-01-01&to=2008-03-05&main=4&comparing=6,3


flashMovie.setLogarithmic(chartId, axis, param)

This function will change value axis scale from simple to logarithmic or backwards. Note, the axis can not be logarithmic when data sets are compared.


flashMovie.setCursorMode(mode)

This function will set cursor mode. Available modes are "pan" and "zoom"


flashMovie.setDrawingMode(mode)

This function will set trend line drawing mode to "true" or "false"


flashMovie.setErasingMode(mode)

This function will set trend line erasing mode to "true" or "false"


flashMovie.getTrendLines(cid)

This function will ask chart to return all the available trend lines (you might want to save trend lines drawn by the user) The chart will call amGetTrendLines(chart_id, trend_lines) function.


flashMovie.selectPeriod(pid)

Select predefined period. id is the pid attribute: <period type="DD" count="10" pid="p1">10D</period> or order number of your period if you don't have pid attribute.


flashMovie.startPlayBack(pid)

This function will start playback (same as clicking play button on the scroller/preview pane)


flashMovie.stopPlayBack(pid)

This function will stop playback (same as clicking play button on the scroller/preview pane)

Functions that are called by the chart

amChartInited(chart_id)

This function is called when the chart is fully loaded and initialized.


amProcessCompleted(chart_id, process_name)

This function is called when the chart finishes doing some task triggered by another JavaScript function.


amReturnData(chart_id, data)

This function is called when you request data from a chart by calling the flashMove.getData() function.


amReturnSettings(chart_id, settings)

This function is called when you request settings from a chart by calling the flashMove.getSettings() function.


amReturnImageData(chart_id, data)

When exporting chart as an image, the chart passes image data to this function.


amReturnParam(chart_id, param)

This function is called when you request a setting from a chart by calling the flashMovie.getParam(param) function.


amError(chart_id, message)

This function is called when an error occurs, such as no data, or file not found.


amRolledOver(chart_id, date, period, data_object)

This function is called when indicator position changes. Please see the description of amClickedOn below for info on data_object parameter.


amClickedOn(chart_id, date, period, data_object)

This function is called when user clicks on plot area.

Data object contains data about all the datapoints in the clicked date/time. I.e.:

a) when data is not grouped into longer periods:

  values: 
    volume: 
      close: 21010110 
  id: 0 
  short: ES 
  title: East Stock 

b) when data is grouped into longer periods:

  values: 
    volume: 
      close: 16344710 
      high: 21587410 
      low: 16344710 
      sum: 90934150 
      open: 16509710 
  id: 1 
  short: ES 
  title: East Stock 

amGetTrendLines(chart_id, trend_lines)

This function is called when trend lines were requested by calling flashMovie.getTrendLines(chartId) method. Note, "chart_id" in return object results is the "cid" attribute in your settings xml here. It will return array of trend lines. Each trend line is an object containing the following values:

chart_id, line_color, line_width, line_alpha, dash_length, locked, value0, value1, time0, time1, axis

amRolledOverLegend(chart_id, cid, gid)

This function is called when user rolls-over legend item


amRolledOverEvent(chart_id, date, description, id, url)

This function is called when user roll-overs some event.


amClickedOnEvent(chart_id, date, description, id, url)

This function is called when user clicks on some event.


amGetZoom(chart_id, from, to)

This function is called every time then the selected period is changed.


amPeriodSelected(chart_id, type, count, id)

This function is called every time user clicks on the predefined period button. id is the pid attribute of the <period> tag or it's sequence number.


amGraphHide(chart_id, cid, gid)

This function is called when the user hides graph (gid for compared graphs will be formatted like this: compared_<did>_<gid> where <did> is the dataset's id).


amGraphShow(chart_id, cid, gid)

This function is called when the user shows graph (gid for compared graphs will be formatted like this: compared_<did>_<gid> where <did> is the dataset's id).


amSelectDataSet(chart_id, did)

This function is called when the user changes main data set.


amCompareDataSet(chart_id, did)

This function is called when the user selects a data set for comparing.


amUncompareDataSet(chart_id, did)

This function is called when the user deselects a data set selected for comparing.


amGetStatus(chart_id, status)

This function is called when user calls flashMovie.getStatus() function.