Class: XmlChart

bcdui.component.chart. XmlChart

Implements XML-definition interface. Extends the JS implementation of the Chart class allowing an XML definition model as input.

new bcdui.component.chart.XmlChart(args)

Constructor of bcdui.component.XmlChart, called by prototype.
Name Type Description
args Object Parameter object
Name Type Default Description
targetHtml targetHtmlRef Where to place the chart
config bcdui.core.DataProvider Definition of the chart according to XSD http://www.businesscode.de/schema/bcdui/charts-1.0.0
suppressInitialRendering boolean false optional If true, the renderer does not initially auto execute but waits for an explicit execute
id string optional Page unique id for used in declarative contexts. If provided, the chart will register itself
showAxes boolean true optional If false, no axes will be shown
title string optional Title
suppressInitialRendering boolean false optional As every renderer, charts will execute and output itself automatically and their parameters after creation. This can be suppressed here.
width number optional Overwrite the chart's auto-width derived from targetHtml
height number optional Overwrite the chart's auto-height derived from targetHtml

Extends

Members

constantAREACHARTinteger

constantBARCHARTinteger

constantGAUGECHARTinteger

constantidstring

A globally unique id of the object. DataProviders do also register themselves at bcdui.factory.objectRegistry when an id is provided to the constructor. This id is only needed in declarative contexts, like jsp or, when a DataProvider is accessed in a xPath like . If not provided in the constructor, a random id starting with 'bcd' is set, but the object is not automatically registered.

constantLINECHARTinteger

constantMARIMEKKOCHARTinteger

constantPIECHARTinteger

constantPOINTCHARTinteger

constantsavedStatusbcdui.core.Status

Example
if( model.getStatus() === model.savedStatus )
  ...

constantsaveFailedStatusbcdui.core.Status

constantSCATTEREDCHARTinteger

Methods

Adds a data series to the chart
Name Type Description
args Object Parameter object
Name Type Default Description
yAxis1Or2 integer optional 1 for left and 2 for right axis
yData Array.<number> optional Data array or provide yDataInfo
yDataInfo DomNodeSet optional XML nodeset with data
sizeData Array.<number> optional 2nd value for scattered charts
xValues Array.<number> optional For x-y charts
chartType integer | string optional Either name or numeric value for chart type
rgb string optional Color
dashstyle string optional Dash style
baseColors Array.<string> optional Colors defining the tones of the generated colors, for example in case of a pie chart
caption string optional Series caption
width number optional Line width
onClick function | string optional Either a function or the name of a function
toSeriesPercentage boolean false optional If true, each value is represented by its percentage value of the full series.

inherited addStatusListener(args)

Listen for any status to be reached. For use cases with the ready status (by far the most common), see onReady() and onceReady() convenience functions.
Name Type Description
args function | bcdui.core.StatusListener | AddStatusListenerParam Either a function executed on all status transitions or a parameter map AddStatusListenerParam

inherited debugIsWaitingFor(){string}

Returns:
Type Description
string Human readable message, which DataProviders, this DataProvider depends on, are not currently in ready state

inherited debugStatus(){string}

Returns:
Type Description
string Human readable message about the current state state
Instead of calling this method directly, better rely on a Renderer or on method onReady().
Executes the process implemented by the concrete sub-class This method is called by the Renderer when it is ready to render the model It is often asynchronous. Note, Renderer and sub-classes execute all input models recursively automatically. This means, usually you do not need to call this method directly. Note: it is asynchronous. Use method .onReady({executeIfNotReady: true, onSuccess: callback }) if no Renderer is involved.
Name Type Default Description
doesRefresh boolean true optional Set this parameter to "false" if this method should do nothing when the object is already in the ready status. The default is "true" meaning that the process is re-started when it is currently ready.
asynchronously fetch data for this data provider.
Returns:
Type Description
Promise.<bcdui.core.DataProvider> resolving once data has been loaded, first argument is this instance
Example
new bcdui.core.SimpleModel("data.xml").fetchData().then((dp)=>{ console.info(dp.getData()); })
This informs modification listeners, registered via onChange(args), that a change set was completed and data is consistent again.
Example
// Use of data modification events
var model = new bcdui.core.StaticModel({ data: { value: 3 } });
model.execute();
model.onChange( function(m) {
  console.log(m.getData().value);
});
model.getData().value ++;
model.fire(); // console prints '4'

getData(){document}

Returns:
Type Description
document DOM document

inherited abstractgetFailedStatus(){Array.<bcdui.core.Status>}

Getter for the list of error statuses of this class. This implementation returns an empty list.
Returns:
Type Description
Array.<bcdui.core.Status> The status objects corresponding to failures in the object's process.
Getter for the name of the data provider. This name is for example used to set parameters names of a bcdui.core.TransformationChain.
Returns:
Type Description
string The name of the data provider. This name should be unique within the scope it is used and is usually not globally unique (as the id).
Returns:
Type Description
bcdui.core.DataProvider model with the chart data
Getter for the status of this object. See bcdui.core.status for possible return values.
Returns:
Type Description
bcdui.core.Status The current status.
Tests if the object has reached a failure status. These status codes are returned by the "getFailedStatus" method.
Returns:
Type Description
boolean True, if the object's process has failed.
True, if DataProvider is ready and there are no uncommitted write transactions, see isReady() and fire().
Returns:
Type Description
boolean
Tests if the current state is the readyStatus. This status is the same status as returned by "getReadyStatus".
Returns:
Type Description
boolean True, if the object is ready.

inherited onceReady(listenerObject)

Name Type Description
listenerObject function | OnceReadyParam Either a function to be called on ready status (i.e. onSuccess) or a parameter map OnceReadyParam. To listen for other states see addStatusListener()
Example
myModel.onceReady({onSuccess: myCallback, executeIfNotReady: true})

inherited onChange(listenerObject, trackingXPath)

Name Type Description
listenerObject function | OnChangeParam Either a function to be called after changes or a parameter map OnChangeParam. Listeners can be removed with removeDataListener()
trackingXPath string optional xPath to monitor to monitor for changes

inherited onReady(listenerObject)

Name Type Description
listenerObject function | OnReadyParam Either a function to be called on ready status (i.e. onSuccess) or a parameter map OnReadyParam. To listen for other states see addStatusListener()
Example
myModel.onReady({onSuccess: function(){ console.log("ready") }, executeIfNotReady: true, onlyFuture: true})
Convenience method for debugging showing data in a prompt for copy-and-paste

inherited removeDataListener(listenerObject)

Name Type Description
listenerObject string | function | RemoveDataListenerParam Either a listener function or id or a parameter map RemoveDataListenerParam. Listeners are added with onChange()

inherited removeStatusListener(args)

Name Type Description
args function | bcdui.core.StatusListener | RemoveStatusListenerParam The listener to be removed. This can either be a function or a StatusListener or a parameter map RemoveStatusListenerParam.
Sends the current data to the original URL

inherited serialize(){string}

Serialize dataprovider's data if available
Returns:
Type Description
string String containing the serialized data
Define series as being stacked
Name Type Description
args Object map with
Name Type Default Description
axis integer 1 for left axis 2 for right one
chartType integer | string Either name or numeric value for chart type
asPercent boolean optional Each series is calculated to its percentage of the sum if all series and shown as *100'%'
isStacked boolean true optional Whether to stack or not
Name Type Description
args bcdui.core.Status
Defines x (horizontal) axis
Name Type Description
args Object Parameter object
Name Type Description
categories Array.<number> optional Distinct values, provide this or xValues
xValues Array.<number> optional Values for continuous axis for x-y charts
caption string optional Axis caption
unit string optional Unit like € or sec. If '%', values are shown as percent. Use '% ' to show percent without dividing by 100
layoutFlow string optional css value
Defines left y axis
Name Type Description
args Object Parameter object
Name Type Default Description
caption string optional Axis caption
unit string optional Unit like € or sec. If '%', values are shown as percent. Use '% ' to show percent without dividing by 100
layoutFlow string optional css value
minValueUser number optional User set axis min value. Only used when below lowest actual value
maxValueUser number optional User set axis max value. Only used when above highest actual value
showGrid boolean true optional If false, no horizontal grid is shown but only small lines next to the y-axis values
Defines right y axis
Name Type Description
args Object Parameter object
Name Type Description
caption string optional Axis caption
unit string optional Unit like € or sec. If '%', values are shown as percent. Use '% ' to show percent without dividing by 100
layoutFlow string optional css value
minValueUser number optional User set axis min value. Only used when below lowest actual value
maxValueUser number optional User set axis max value. Only used when above highest actual value

inherited tblDelete(args){number}

updates wrs rows with given data. Either a single row (via rowId) or single/multiple ones (via filter)
Name Type Description
args Object parameter bag
Name Type Default Description
filter Object optional object holding cell values which should be used for selecting the rows for update, e.g. { country: 'DE', flag: true }
rmi boolean true optional use wrs:M syntax when this is true, otherwise row columns element name is not touched
fire boolean true optional lets the listeners know, that the update was finished
rowId string optional id specifying row which should be deleted (or use filter)
Returns:
Type Description
number count of removed rows

inherited tblInsert(args){string}

inserts a new row in the wrs data, values given as object
Name Type Description
args Object parameter bag
Name Type Default Description
values Object object holding cell values which should be inserted, e.g. { country: 'DE', flag: true }
rmi boolean true optional use wrs:I syntax when this is true, otherwise wrs:R is used, rmi=true also prefills default values
fire boolean true optional lets the listeners know, that the update was finished
Returns:
Type Description
string row id of newly inserted row

inherited tblSelect(args){Array.<Object>}

returns an array of requested data
Name Type Description
args Object parameter bag
Name Type Description
filter Object optional object holding cell values which should be used for selecting the rows for update, e.g. { country: 'DE', flag: true }
columns Array.<string> optional string array of requested columns, if not given, all columns are returned
Returns:
Type Description
Array.<Object> Array of objects holding the requested data

inherited tblSelectRow(args){Object}

returns one object representing the filtered data (either filter or rowId). In case of multiple filter matches, the first one is returned
Name Type Description
args Object parameter bag
Name Type Description
filter Object optional object holding cell values which should be used for selecting the rows for update, e.g. { country: 'DE', flag: true }
rowId string optional rowId of row which should be queried (or use filter)
columns Array.<string> optional string array of requested columns, if not given, all columns are returned
Returns:
Type Description
Object Array of objects holding the requested data

inherited tblUpdate(args){number}

updates wrs rows with given data. Either a single row (via rowId) or single/multiple ones (via filter)
Name Type Description
args Object parameter bag
Name Type Default Description
values Object object holding cell values which should be used for updating, e.g. { country: 'DE', flag: true }
filter Object optional object holding cell values which should be used for selecting the rows for update, e.g. { country: 'DE', flag: true }
rmi boolean true optional use wrs:M syntax when this is true, otherwise row columns element name is not touched
fire boolean true optional lets the listeners know, that the update was finished
rowId string optional id specifying row which should be updated (or use filter)
Returns:
Type Description
number count of updated rows
Debugging function showing a text for this class.
Returns:
Type Description
string A summary of the class.