sap.chart.Chart.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.chart.Chart with name
sClassName
and enriches it with the information contained in
oClassInfo
.
oClassInfo
might contain the same kind of information as described in sap.viz.ui5.controls.common.BaseControl.extend.
Parameters:
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
Returns:
{function} | Created class / constructor function |
Returns a metadata object for class sap.chart.Chart.
Returns:
addData()
Unsupported. Chart manages the "data" aggregation only via data binding. The method "addData" therefore cannot be used programmatically!
Adds some dimension to the aggregation dimensions
.
Parameters:
Returns:
Adds some measure to the aggregation measures
.
Parameters:
Returns:
Add one or more categories to current category selections, specified by category objects.
Category object has the following structure:
{
measure: measureName,
dimensions: {
dimensionName1: dimensionValue1,
dimensionName2: dimensionValue2,
...
}
}
Only works when selectionBehavior is "CATEGORY"
Parameters:
{array} | aCategories | an array of category objects |
Returns:
Add one or more data points to current data point selection, specified by datapoint objects.
Datapoint object has the following structure:
{
groupId: "groupId", // group ID (optional)
index: index, // index of the data in the group
measures: ["measureId"] // measure IDs
}
Only works when selectionBehavior is "DATAPOINT"
Parameters:
{array} | aDataPoints | an array of datapoint objects. |
Returns:
Add one or more series to current series selections, specified by series objects.
Series object has the following structure:
{
measure: measureName,
dimensions: {
dimensionName1: dimensionValue1,
dimensionName2: dimensionValue2,
...
}
}
Only works when selectionBehavior is "SERIES"
Parameters:
{array} | aSeries | an array of series objects |
Returns:
Attaches event handler
fnFunction
to the
deselectData
event of this
sap.chart.Chart
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.chart.Chart
itself.
Event fires when certain data point(s) is(are) deselected, data context of deselected item(s) would be passed in
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.chart.Chart itself |
Returns:
Attaches event handler
fnFunction
to the
drilledDown
event of this
sap.chart.Chart
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.chart.Chart
itself.
fired after a drill-down operation
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.chart.Chart itself |
Returns:
Attaches event handler
fnFunction
to the
drilledUp
event of this
sap.chart.Chart
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.chart.Chart
itself.
fired after a drill-up operation
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.chart.Chart itself |
Returns:
Attaches event handler
fnFunction
to the
renderComplete
event of this
sap.chart.Chart
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.chart.Chart
itself.
Event fires when the rendering ends.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.chart.Chart itself |
Returns:
Attaches event handler
fnFunction
to the
selectData
event of this
sap.chart.Chart
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.chart.Chart
itself.
Event fires when certain data point(s) is(are) selected, data context of selected item(s) would be passed in.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.chart.Chart itself |
Returns:
Parameters:
{object} | oBindingInfo | The binding information |
Returns:
destroyData()
Unsupported. Chart manages the "data" aggregation only via data binding. The method "destroyData" therefore cannot be used programmatically!
Destroys all the dimensions in the aggregation dimensions
.
Returns:
Destroys all the measures in the aggregation measures
.
Returns:
Detaches event handler
fnFunction
from the
deselectData
event of this
sap.chart.Chart
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Detaches event handler
fnFunction
from the
drilledDown
event of this
sap.chart.Chart
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Detaches event handler
fnFunction
from the
drilledUp
event of this
sap.chart.Chart
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Detaches event handler
fnFunction
from the
renderComplete
event of this
sap.chart.Chart
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Detaches event handler
fnFunction
from the
selectData
event of this
sap.chart.Chart
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
drillDown(vDimensions)
Drill down on specific Dimension(s).
The drill down Dimension(s) must present in the Dimension aggregation and must NOT present in previous drill down or be visible already.
Parameters:
{array} | vDimensions | an array, or just a single instance, of either Dimension instance or Dimension name to drill down |
drillUp()
Drill up to previous drill down state, or remove the last visible Dimension
Fires event deselectData
to attached listeners.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Fires event
drilledDown
to attached listeners.
Expects the following event parameters:
dimensions
of type string[]
array of strings holding the names of the added dimensions
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Fires event
drilledUp
to attached listeners.
Expects the following event parameters:
dimensions
of type string[]
array of strings holding the names of the removed dimensions
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Fires event renderComplete
to attached listeners.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Fires event selectData
to attached listeners.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
getAvailableChartTypes(): object
Returns available and unavailable chart types with current Dimensions and Measures. An error info will be returned along with each unavailable chart types.
{
available: [{
chart: "chartType"
}, ...],
unavailable: [{
chart: "chartType"
error: {
missing: {
Dimension: n,
Measure: n,
DateTimeDimension: n
}
}
}, ...]
}
Returns:
{object} | chart types and errors for unavailable chart types, grouped by availability |
getChartType(): string
Gets current value of property
chartType
.
Type of the Chart.
Refer to supported chart enum sap.chart.ChartType
Default value is bar
.
Returns:
{string} | Value of property chartType |
getData()
Unsupported. Chart manages the "data" aggregation only via data binding. The method "getData" therefore cannot be used programmatically!
Return Dimension with the given name.
Parameters:
{string} | sName | name of the Dimension to get |
Returns:
Gets content of aggregation
dimensions
.
Dimensions of the data.
Returns:
getEnablePagination(): boolean
Gets current value of property
enablePagination
.
Enable pagination mode.
Pagination mode empowers users to visualize dataset page by page by scrolling back or forth. Currently there are some limitations of this mode in some chart transversal features. Please refer to release notes for details.
Default value is false
.
Experimental API:This property is only for experimental usage!!! It only works with constructor and cannot be changed during runtime.
- Experimental:
- This property is only for experimental usage!!! It only works with constructor and cannot be changed during runtime.
Returns:
{boolean} | Value of property enablePagination |
getInResultDimensions(): string[]
Gets current value of property
inResultDimensions
.
Names of the inResult dimensions.
inResult dimension do not show up in chart layout, i.e. axis/legend. They do show in tooltip, popover, and in selection results.
Default value is []
.
Returns:
{string[]} | Value of property inResultDimensions |
getIsAnalytical(): boolean
Gets current value of property
isAnalytical
.
Whether or not an aggregated entity set is bound to the chart.
Returns:
{boolean} | Value of property isAnalytical |
Return Measure with the given name.
Parameters:
{string} | sName | name of the Measure to get |
Returns:
Gets content of aggregation
measures
.
Measures of the data.
Returns:
getSelectedCategories(): object
Return category objects of currently selected categories and a total number of selected data points.
Category object has the following structure:
{
measure: measureName,
dimensions: {
dimensionName1: dimensionValue1,
dimensionName2: dimensionValue2,
...
}
}
Return 0 and empty list if selectionBehavior is not "CATEGORY"
Returns:
{object} | a total number of selected data points, and an array of category objects for selected categories. |
getSelectedDataPoints(): object
Return a total number and an array of datapoint objects (including a Context object) of currently selected data points.
Datapoint object has the following structure:
{
groupId: "groupId", // group ID (optional)
index: index, // index of the data in the group
measures: ["measureId"] // measure IDs (data points created from the same Context object
// differing only in measure names are merged together)
context: [Context] // Context object
}
Only works when selectionBehavior is "DATAPOINT"
Returns:
{object} | a total number of selected data points, and an array of datapoint objects. |
getSelectedSeries(): object
Return series objects of currently selected series and a total number of selected data points.
Series object has the following structure:
{
measure: measureName,
dimensions: {
dimensionName1: dimensionValue1,
dimensionName2: dimensionValue2,
...
}
}
Return 0 and empty list if selectionBehavior is not "SERIES"
Returns:
{object} | object containing a total number of selected data points, and an array of series objects for selected series. |
getSelectionBehavior(): string
Gets current value of property
selectionBehavior
.
Chart selection behavior.
Supported values are "DATAPOINT", "CATEGORY", or "SERIES", case insensitive, always return in upper case.
Unsupported values will be ignored.
Default value is DATAPOINT
.
Returns:
{string} | Value of property selectionBehavior |
getSelectionMode(): string
Returns:
{string} | Value of property selectionMode |
getTimeDimensions(): array
Return all TimeDimensions from current Dimensions.
Returns:
{array} | Dimensions which are instance of TimeDimension. |
getUiConfig(): object
Gets current value of property
uiConfig
.
Configuration for initialization to VizControl. This property could only set via settings parameter in Constructor.
Returns:
{object} | Value of property uiConfig |
getVisibleDimensions(): string[]
Gets current value of property
visibleDimensions
.
Names of the Dimensions to be displayed in the Chart.
Depending on chart type, insufficient number of visible Dimension
s will cause error.
Default value is []
.
Returns:
{string[]} | Value of property visibleDimensions |
getVisibleMeasures(): string[]
Gets current value of property
visibleMeasures
.
Names of the Measures to be displayed in the Chart.
Depending on chart type, insufficient number of visible Measure
s will cause errors.
Default value is []
.
Returns:
{string[]} | Value of property visibleMeasures |
getVizProperties(): object
Return Chart's properties.
Refer to chart property documentation for more details.
Returns:
{object} | the Chart properties object |
getVizScales(): object[]
Return Chart's scales.
Refer to chart property documentation for more details.
Returns:
{object[]} | an array of scale objects |
getVizUid(): string
Get the UID for Chart. It supports other controls to connect to a viz instance.
Returns:
indexOfData()
Unsupported. Chart manages the "data" aggregation only via data binding. The method "indexOfData" therefore cannot be used programmatically!
indexOfDimension(oDimension): int
Checks for the provided sap.chart.data.Dimension
in the aggregation dimensions
. and returns its index if found or -1 otherwise.
Parameters:
Returns:
{int} | The index of the provided control in the aggregation if found, or -1 otherwise |
indexOfMeasure(oMeasure): int
Checks for the provided sap.chart.data.Measure
in the aggregation measures
. and returns its index if found or -1 otherwise.
Parameters:
Returns:
{int} | The index of the provided control in the aggregation if found, or -1 otherwise |
insertData()
Unsupported. Chart manages the "data" aggregation only via data binding. The method "insertData" therefore cannot be used programmatically!
Inserts a dimension into the aggregation dimensions
.
Parameters:
{sap.chart.data.Dimension} | oDimension | the dimension to insert; if empty, nothing is inserted |
{int} | iIndex | the 0 -based index the dimension should be inserted at; for a negative value of iIndex , the dimension is inserted at position 0; for a value greater than the current size of the aggregation, the dimension is inserted at the last position |
Returns:
Inserts a measure into the aggregation measures
.
Parameters:
{sap.chart.data.Measure} | oMeasure | the measure to insert; if empty, nothing is inserted |
{int} | iIndex | the 0 -based index the measure should be inserted at; for a negative value of iIndex , the measure is inserted at position 0; for a value greater than the current size of the aggregation, the measure is inserted at the last position |
Returns:
removeAllData()
Unsupported. Chart manages the "data" aggregation only via data binding. The method "removeAllData" therefore cannot be used programmatically!
Removes all the controls from the aggregation
dimensions
.
Additionally, it unregisters them from the hosting UIArea.
Returns:
Removes all the controls from the aggregation
measures
.
Additionally, it unregisters them from the hosting UIArea.
Returns:
removeData()
Unsupported. Chart manages the "data" aggregation only via data binding. The method "removeData" therefore cannot be used programmatically!
Removes a dimension from the aggregation dimensions
.
Parameters:
Returns:
Removes a measure from the aggregation measures
.
Parameters:
Returns:
Deselect one or more categories from current category selections, specified by category objects.
Category object has the following structure:
{
measure: measureName,
dimensions: {
dimensionName1: dimensionValue1,
dimensionName2: dimensionValue2,
...
}
}
Only works when selectionBehavior is "CATEGORY"
Parameters:
{array} | aCategories | an array of category objects |
Returns:
Deselect one or more data points from current data point selections, specified by datapoint objects.
Datapoint object has the following structure:
{
groupId: "groupId", // group ID (optional)
index: index, // index of the data in the group
measures: ["measureId"] // measure IDs
}
Only works when selectionBehavior is "DATAPOINT"
Parameters:
{array} | aDataPoints | an array of datapoint objects. |
Returns:
Deselect one or more series from current series selections, specified by series objects.
Series object has the following structure:
{
measure: measureName,
dimensions: {
dimensionName1: dimensionValue1,
dimensionName2: dimensionValue2,
...
}
}
Only works when selectionBehavior is "SERIES"
Parameters:
{array} | aSeries | an array of series objects |
Returns:
Reset to visible layout.
Returns:
Sets a new value for property
chartType
.
Type of the Chart.
Refer to supported chart enum sap.chart.ChartType
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is bar
.
Parameters:
{string} | sChartType | New value for property chartType |
Returns:
Sets a new value for property
enablePagination
.
Enable pagination mode.
Pagination mode empowers users to visualize dataset page by page by scrolling back or forth. Currently there are some limitations of this mode in some chart transversal features. Please refer to release notes for details.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Experimental API:This property is only for experimental usage!!! It only works with constructor and cannot be changed during runtime.
Parameters:
{boolean} | bEnablePagination | New value for property enablePagination |
- Experimental:
- This property is only for experimental usage!!! It only works with constructor and cannot be changed during runtime.
Returns:
Sets a new value for property
inResultDimensions
.
Names of the inResult dimensions.
inResult dimension do not show up in chart layout, i.e. axis/legend. They do show in tooltip, popover, and in selection results.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is []
.
Parameters:
{string[]} | sInResultDimensions | New value for property inResultDimensions |
Returns:
Sets a new value for property
isAnalytical
.
Whether or not an aggregated entity set is bound to the chart.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
{boolean} | bIsAnalytical | New value for property isAnalytical |
Returns:
Select one or more categories, specified by category objects.
Category object has the following structure:
{
measure: measureName,
dimensions: {
dimensionName1: dimensionValue1,
dimensionName2: dimensionValue2,
...
}
}
Only works when selectionBehavior is "CATEGORY"
Parameters:
{array} | aCategories | an array of category objects |
Returns:
Select one or more data points, specified by datapoint objects.
Datapoint object has the following structure:
{
groupId: "groupId", // group ID (optional)
index: index, // index of the data in the group
measures: ["measureId"] // measure IDs
}
Only works when selectionBehavior is "DATAPOINT"
Parameters:
{array} | aDataPoints | an array of datapoint objects. |
Returns:
Select one or more series, specified by series objects.
Series object has the following structure:
{
measure: measureName,
dimensions: {
dimensionName1: dimensionValue1,
dimensionName2: dimensionValue2,
...
}
}
Only works when selectionBehavior is "SERIES"
Parameters:
{array} | aSeries | an array of series objects |
Returns:
Sets a new value for property
selectionBehavior
.
Chart selection behavior.
Supported values are "DATAPOINT", "CATEGORY", or "SERIES", case insensitive, always return in upper case.
Unsupported values will be ignored.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is DATAPOINT
.
Parameters:
{string} | sSelectionBehavior | New value for property selectionBehavior |
Returns:
Sets a new value for property
selectionMode
.
Chart selection mode.
Supported values are sap.chart.SelectionMode.Single or sap.chart.SelectionMode.Multi, case insensitive, always return in upper case.
Unsupported values will be ignored.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is sap.chart.SelectionMode.Multi
.
Parameters:
{string} | sSelectionMode | New value for property selectionMode |
Returns:
setUiConfig(oUiConfig)
Setter for property uiConfig. uiConfig could only set via settings parameter of constructor.
uiConfig from base type could config the instance. Supported uiConfig keyword: applicationSet, showErrorMessage
Example:
var chart = new sap.chart.Chart({
'chartType' : 'bar',
'uiConfig' : {
'applicationSet' : 'fiori',
'showErrorMessage' : true
}
});
Parameters:
{object} | oUiConfig | the UI configuration |
Sets a new value for property
visibleDimensions
.
Names of the Dimensions to be displayed in the Chart.
Depending on chart type, insufficient number of visible Dimension
s will cause error.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is []
.
Parameters:
{string[]} | sVisibleDimensions | New value for property visibleDimensions |
Returns:
Sets a new value for property
visibleMeasures
.
Names of the Measures to be displayed in the Chart.
Depending on chart type, insufficient number of visible Measure
s will cause errors.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is []
.
Parameters:
{string[]} | sVisibleMeasures | New value for property visibleMeasures |
Returns:
setVizProperties(oVizProperties)
Change Chart's properties.
Chart's properties will be updated with the parameter.
Refer to chart property documentation for more details.
Parameters:
{object} | oVizProperties | object containing vizProperty values to update |
setVizScales(oVizScales)
Change Chart's scales.
Chart's scales will be updated with the parameters.
Refer to chart property documentation for more details.
Parameters:
{object[]} | oVizScales | array of vizScale objects |
Unbinds aggregation data
from model data.
Returns:
zoom(oConfig)
Zoom the chart plot.
Example:
var oChart = new sap.chart.Chart(...);
oChart.zoom({direction: "in"});
Parameters:
{object} | oConfig | contains a "direction" attribute with value "in" or "out" indicating zoom to enlarge or shrink respectively |