Message Logger > Client side JavaScript API |
FusionWidgets allows you to control few aspects of the message logger using its client side JavaScript API. Basically, you can do the following:
Here, we'll see how to do these. |
Manipulating the logger using client side JavaScript |
To use client side JavaScript API, you first need to make sure that you've embedded the chart with registerWithJS flag set to 1. Else, you'll get JavaScript errors stating that the object is undefined. You'll need to initialize the chart using following code. Note the last parameter (registerWithJS) set to 1. var myChart = new FusionCharts("RealTimeLine.swf", "ChId1", "500", "350", "0", "1"); Once the chart has loaded, initialized and rendered, you can get reference back to the chart in your JavaScript code using the code below. Here, ChId1 is the id of the chart which we've defined in the chart constructor above. var refToChart = getChartFromId("ChId1"); You can access the chart using this function only after it has loaded. As such, we always recommend to put this code block in FC_Rendered event tracker code block. For more information, please see the section "FusionWidgets and JavaScript" Once the reference to chart is attained, you can use any of the functions below on the chart's logger (provided it's set to on):
If you get JavaScript errors when accessing the above functions, make sure of following:
|