FusionWidgets allows you to control few aspects of the message logger using its client-side JavaScript API. Basically, you can do the following:

  • Show/hide the logger using client-side JavaScript
  • Clear the logger using client-side JavaScript

Here, we'll see how to do these.

Please note that Message Logger feature is not supported in JavaScript charts.

Manipulating the logger using client-side JavaScript

You can manipulate the message logger using JavaScript APIs. For this, you need to get the reference to the chart. To get the reference to a chart, you can use the DOMID of the chart and pass it using any of the following ways:

var chartRef = FusionCharts("myChartId");

or

var chartRef = FusionCharts.items["myChartId"]; 

The legacy function getChartFromId() still works as show below:

var chartRef =  getChartFromId("myChartId"); 

However, note that getChartFromId() has been deprecated.

You can call the JavaScript APIs of a chart only after it has rendered. You can use the FC_Rendered event tracker or the Rendered event listener to check if a chart has rendered. For more information, please see FusionWidgets & JavaScript section.

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):

  • chartRef.showLog() - To show the log, if it's not already visible.
  • chartRef.hideLog() - To hide the log, if it's visible.
  • chartRef.clearLog() - To clear the contents of log.

If you get JavaScript errors when accessing the above functions, make sure of following:

  1. You've enabled the message logger for the chart.
  2. You're accessing these functions after the chart has rendered (i.e., in FC_Rendered event tracker code block or in the Rendered event listener)
  3. You're not running the chart from local file system (i.e., C:\, D:\ etc.). Instead, run it from a server (localhost or remote server). This is because the Flash Player security settings do not allow chart to JavaScript interaction on local file system by default, unless otherwise specifically set.