Class actuate.report.Chart
Description
Provides functions to operate on a chart element, such as changing its format or retrieving data from specific elements.
Constructor
The actuate.report.Chart object is created when actuate.viewer.PageContent.getChartByBookmark( ) is called.
Function summary
Table 44‑26 lists actuate.report.Chart functions.
Table 44‑26 actuate.report.Chart functions
Function
Description
Clears the filters applied to the given column
Drills down into a chart by category
Drills down into a chart by series
Drills up one level by category
Drills up one level by series
Returns the report element bookmark name
Returns an HTML5 instance of this chart
Returns the HTML element DOM object
Returns the report element instance id
Returns the page content to which this element belongs
getType( )
Returns the report element type
hide( )
Hides this element
Sets the title for this chart
Sets the number of dimensions for the chart element
Applies filters to this chart element
Sets the width and height of the chart element
Sets a chart subtype to the chart element
show( )
Shows this element
submit( )
Submits all the asynchronous operations that the user has requested on this report and renders the chart component on the page
clearFilters
Syntax
void Chart.clearFilters(string columnName)
Clears the filters for a given column.
Parameter
columnName
String. The name of the column.
Example
This example clears existing filters from the PRODUCTLINE column of a chart and changes the chart title:
function resetFilter(bchart){
bchart.clearFilters("PRODUCTLINE");
bchart.setChartTitle("Orders By Country");
bchart.submit( );
}
drillDownCategory
Syntax
void Chart.drillDownCategory(string categoryData)
Drills down into a chart by category.
Parameter
categoryData
String. The name of the data category to drill down to.
drillDownSeries
Syntax
void Chart.drillDownSeries(string seriesName)
Drills down into a chart by series.
Parameter
seriesName
String. The name of the data series to drill down to.
drillUpCategory
Syntax
void Chart.drillUpCategory( )
Drills up into a chart by one data category level.
drillUpSeries
Syntax
void Chart.drillUpSeries( )
Drills up into a chart by one series level.
getBookmark
Syntax
string Chart.getBookmark( )
Returns the chart’s bookmark name.
Returns
String. The chart’s bookmark name.
Example
This example sets the chart’s title to the bookmark name:
function titleBookmark(bchart){
bchart.setChartTitle(bchart.getBookmark( ));
bchart.submit( );
}
getClientChart
Syntax
actuate.report.HTML5Chart.ClientChart Chart.getClientChart( )
Returns the HTML5 Chart instance if this chart has an HTML5 Chart output format, otherwise returns null.
Returns
actuate.report.HTML5Chart.ClientChart. The HTML5 formatted chart or null.
Example
This example displays the chart ID of the HTML5 chart in an alert box:
 
function showHTML5ChartID(myChart){
var myHTML5Chart = myChart.getClientChart( );
var HTML5ChartID = myHTML5Chart.getViewerId( );
alert (HTML5ChartID);
}
getHtmlDom
Syntax
HTMLElement Chart.getHtmlDom( )
Returns the HTML element for this chart.
Returns
HTMLElement. The HTML DOM element.
Example
This example displays the HTML DOM element for this chart inside a red border:
function showHtmlDom(myChart){
var domNode = myChart.getHtmlDom( );
var box = document.createElement('div');
box.style.border = '2px solid red';
var label = document.createElement('h2');
label.innerHTML = 'The HTML DOM:';
box.appendChild(label);
box.appendChild(domNode);
document.body.appendChild(box);
}
getInstanceId
Syntax
string Chart.getInstanceId( )
Returns the instance id of this report element.
Returns
String. The instance id.
Example
This example displays the instance ID of the report element in an alert box:
function showID(myChart){
var elementID = myChart.getInstanceId( );
alert (elementID);
}
getPageContent
Syntax
actuate.viewer.PageContent Chart.getPageContent( )
Returns the content of the page to which this chart belongs.
Returns
actuate.report.PageContent. The report content.
Example
This example displays the viewer ID of the page content in an alert box:
function showViewID(myChart){
var pageContent = myChart.getPageContent( );
var pageViewerID = pageContent.getViewerId( );
alert (pageViewerID);
}
getType
Syntax
string Chart.getType( )
Returns the chart’s report element type.
Returns
String. This method returns the string "Chart" when the type is actuate.report.Chart.CHART and the string "Flash Chart" when the type is actuate.report.Chart.FLASH_CHART.
Example
This example displays the chart type in an alert box:
alert ("Chart is of type " + myChart.getType( ));
hide
Syntax
void Chart.hide( )
Hides this element.
Example
To hide the chart bchart, use code similar to the following:
alert("Hiding chart" + bchart.getBookmark( ));
bchart.hide( );
bchart.submit( );
setChartTitle
Syntax
void Chart.setChartTitle(string title)
Sets the title for this chart element.
Parameter
title
String. The title for the chart.
Example
This example sets the chart’s title to the bookmark name:
function titleBookmark(bchart){
bchart.setChartTitle(bchart.getBookmark( ));
bchart.submit( );
}
setDimension
Syntax
void Chart.setDimension(actuate.report.Chart dimension)
Sets the number of dimensions for the chart element. The chart dimension only works if supported by the chart’s type. A 3D chart does not support multiple value axes. Remove all of the y-axes after the first before converting a chart to 3D.
Parameter
dimension
actuate.report.Chart. The number of dimensions in which to display the chart element. Supported values are 2D and 2D with depth. The constants defined for this argument are:
*actuate.report.Chart.CHART_DIMENSION_2D
*actuate.report.Chart.CHART_DIMENSION_2D_WITH_DEPTH
Example
This example changes the chart bchart’s dimension to 2D with depth:
bchart.setChartTitle(bchart.getBookmark( ) + ": 2D with Depth");
bchart.setDimension(actuate.report.Chart
.CHART_DIMENSION_2D_WITH_DEPTH );
bchart.submit( );
setFilters
Syntax
void Chart.setFilters(actuate.data.Filter filter)
void Chart.setFilters(actuate.data.Filter[ ] filters)
Applies filters to this chart element. To apply more than one filter to a chart element, call this function multiple times, once for each filter object.
Parameters
filter
An actuate.data.Filter object. A single filter condition to apply to this chart element.
filters
An array of actuate.data.Filter objects. Filter conditions to apply to this chart element.
Example
This example applies a filter to the chart and changes the chart’s title to reflect the filter:
function chartFilter(bchart){
var filter = new actuate.data.Filter("PRODUCTLINE", "=",
"Trucks and Buses");
var filters = new Array( );
filters.push(filter);
bchart.setFilters(filters);
bchart.setChartTitle("Orders By Country (Trucks and Buses)");
bchart.submit( );
}
setSize
Syntax
void Chart.setSize(integer width, integer height)
Sets the width and height of the chart element displayed.
Parameters
width
Integer. The width in pixels.
height
Integer. The height in pixels.
Example
To set the chart bchart to be 600 pixels wide by 800 pixels high, use code similar to the following:
alert("Resizing " + bchart.getBookmark( ) + " to 600x800");
bchart.setSize(600,800);
bchart.submit( );
setSubType
Syntax
void Chart.setSubType(string chartType)
Sets a subtype for this chart element. When the report calls submit( ), the report redraws the chart element as the requested type.
Parameter
chartType
String. The format in which to redraw the chart element. The constants that define the chart subtypes are:
*CHART_SUBTYPE_PERCENTSTACKED
*CHART_SUBTYPE_SIDEBYSIDE
*CHART_SUBTYPE_STACKED
Example
To change the subtype of the chart bchart to side-by-side, use code similar to the following:
bchart.setChartTitle("Side by Side Chart");
bchart.setSubType(actuate.report.Chart.CHART_SUBTYPE_SIDEBYSIDE);
bchart.submit( );
show
Syntax
void Chart.show( )
Shows this element.
Example
To reveal the hidden chart bchart, use code similar to the following:
alert("Showing chart" + bchart.getBookmark( ));
bchart.show( );
bchart.submit( );
submit
Syntax
void Chart.submit(function callback)
Submits all the asynchronous operations for this chart. The submit( ) function triggers an AJAX request for all asynchronous operations. When the server finishes the processing, it returns a response and the results are rendered on the page in the chart container.
Parameter
callback
Function. Optional. A function to execute after the asynchronous call processing is done. Submit passes the current actuate.Viewer object to the callback as an input parameter.
Example
This example sets the chart’s title to the bookmark name and pops up an alert box after calling submit( ):
function titleBookmark(bchart){
bchart.setChartTitle(bchart.getBookmark( ));
bchart.submit(alert("Title Changed"));
}