Some actions which are performed by the HTML OLAP Grid/Chart toolbox can be initialized using JavaScript functions of the OLAP controls. This can be used when creating your own toolbox consisting of ASP.NET controls. Access to the API functions is produced through the DOM element of the OLAP control. For example, using jQuery you can do this as follows:
$find('OLAPControl_ClientID'). function();
'OLAPControl_ClientID' – ClientID of the TOLAPGrid/TOLAPChart control.
Below is the table describing the API of the TOLAPGrid/TOLAPChart controls.
Actions | TOLAPGrid | TOLAPChart | JavaScript functions | Type of request |
Export to pdf |
+ |
+ |
exportToPdf('TOLAPExport_ID', 'file_name') |
postback |
Export to xls |
+ |
- |
exportToXls('TOLAPExport_ID', 'file_name') |
postback |
Export to xlsx |
+ |
- |
exportToXlsx('TOLAPExport_ID', 'file_name') |
postback |
Export to html |
+ |
+ |
exportToHtml('TOLAPExport_ID', 'file_name') |
postback |
Export to csv |
+ |
- |
exportToCsv('TOLAPExport_ID', 'file_name') |
postback |
Export to jpeg |
+ |
+ |
exportToJpeg('TOLAPExport_ID', 'file_name') |
postback |
Zoom in |
- |
+ |
increaseScale() |
callback |
Zoom out |
- |
+ |
decreaseScale() |
callback |
Reset Zoom to 100% |
- |
+ |
resetScale() |
callback |
Show pivot areas |
+ |
+ |
showPivotAreas() |
callback |
Show only data |
+ |
+ |
showOnlyData() |
callback |
Show all areas |
+ |
+ |
showAllAreas() |
callback |
Clear layout |
+ |
+ |
clearLayout() |
callback |
Show modification areas |
+ |
+ |
showModificationAreas() |
callback |
Hide modification areas |
+ |
+ |
hideModificationAreas() |
callback |
Set chart type |
- |
+ |
setChartType('Chart_type', Series_area_index, Show_empty_point) |
callback |
Load layout |
+ |
+ |
loadLayout('layoutXml') |
callback |
Arguments of export functions:
'TOLAPExport_ID' – ID of TOLAPExport control. 'file_name' – export file name (default is 'slice').
Argument of 'loadLayout' function:
'layoutXml' – UTF8-encoded xml string of the control layout
Arguments of 'setChartType' function:
'Chart_type' - name of chart type. 'Series_area_index' – defines the series area index, takes integer values. This argument can be used when you need to display the info from the different measures using different graphs.

If Series_area_index is below zero then the type is set for all graphs.
'Show _empty_point' – in the diagram of the 'spline' type defines whether the dots on the graph are visible; in the diagram of the 'points' type defines whether the inner area of points is colored as well as their outline.
Available chart types are presented in the following table.
Custom error handling.
The JavaScript API of HTML Chart/Grid controls provides an ability to change the standard way of an error handling that occur in the controls. To do this create a JavaScript function with one parameter and set its name in the TOLAPChart/TOLAPGrid.ErrorHandler property. The parameter contains the following information:
"Message" – the text of the error message; "GridVersion" – the control version; "CubeVersion" – the cube version; "StackTrace" - stack trace; "RequestInfo" – the encoded request data that leads to an error; "Support" – an email of the Radar-Soft support .
For example:
<radarcube:TOLAPGrid ErrorHandler="errorHandler"></radarcube:TOLAPGrid>
function errorHandler(args) { var errMsg = "GridVersion: " + args.GridVersion + "\n"; errMsg += "CubeVersion: " + args.CubeVersion + "\n"; errMsg += "Message: " + args.Message + "\n"; errMsg += "StackTrace: " + args.StackTrace + "\n" alert(errMsg); }
Callback functions.
Sometimes you need to make some action after the implementation of an AJAX action in the OLAP controls (pivoting, drilling, filtering and others). There are two ways in the API for this:
- Whenever after an AJAX action a JavaScript function which is specified in the TOLAPChart/TOLAPGrid.ClientCallbackFunction property is called:
<radarcube:TOLAPGrid ClientCallbackFunction="callbackFunction()"></radarcube:TOLAPGrid>
function callbackFunction() { alert('Callback done.'); }
- If you need to call a JavaScript callback function only after some specific action and to send a message to this function, you can use the TOLAPChart/TOLAPGrid.MessageHandler property:
<radarcube:TOLAPGrid MessageHandler="callbackMessage"></radarcube:TOLAPGrid>
function callbackMessage(message) { alert(message); }
To initiate a call of the JavaScript callback function it is necessary to call the TOLAPChart/TOLAPGrid.SetClientMessage(string Message) function in the handler of a desired event:
protected void TOLAPGrid1_OnAfterPivot(object sender, TPivotEventArgs e) { TOLAPGrid1.SetClientMessage("Pivoting done."); }
In this example, every time after a pivot implementation the "Pivoting done." message appears.
|