Skip to main content

Dashboard Config

CSA supports multiple dashboards and these are configured in the CSA_config.js file or in the CSA_DASHBOARD_CONFIG environment variable (by reference to that environment variable in CSA_config.js (or see/consider ConfigServlet)) if deployed in a container.

Example dashboard

Example Dashboard

The value DASHBOARD describes all of the available dashboards as named arrays:

var DASHBOARD = {
// default dashboard
default:[
{
index:0,
element:'dashboard-chart',
width:4,
cardTitle:'New contracts this month',
cardMinHeight: '380px',
drilldownType: 'accountType',
apiEndpoint:'http://$HOSTNAME$:8085/api/Tenant1/DataQuery/RetailProductsNewThisMonth?$filter=RowOrder%3D1',
apiMethod:'GET',
apiPayload:null,
dataProcessingFunctionNames:['dashboardNewContractsPie'],
xAxisCategoriesFunctionName:'',

//further attributes depend on the element type. For a chart these may be...
chartConfig:{
config for the chart
}
chartData:[
{
name: 'New contracts',
type: 'pie',
data: [],
},
],
},
{
index:1,
element:'dashboard-chart',
width:4,
cardTitle:'Total balance by product classification',
apiEndpoint:'http://$HOSTNAME$:8085/api/Tenant1/DataQuery/RetailProducts?$filter=RowOrder%3D1',
apiMethod:'GET',
apiPayload:null,
dataProcessingFunctionNames:['dashboardTotalBalanceSeries1'],
xAxisCategoriesFunctionName:'dashboardTotalBalanceXAxisCategories',
highchartsOptions: {lang:{numericSymbols:["k", "M", "B", "T", "q", "Q"],}},
drilldownType: 'accountType',
},
],

// secondary dashboard
secondary_dashboard: [
{
...config for first dashboard card...
},
{
...config for second dashboard card...
},
],

// customer analytics dashboard - appears on the customer overview analytics tab
customer_analytics: [
{
...config for first card...
},
{
...config for second card...
},
]

};

A specific dashboard definition named "customer_analytics" exists to populate the "Analytics" tab on the customer overview. This should not be used as a general dashboard as its contents will be specific to the current customer being viewed. Presentation is slightly different for this dashboard as it appears inside the customer overview card.

Dashboards are either invoked from a menu option (from TA_menus.js)

{
"type": "item",
"label": "menu.Dashboard",
"actionId": "CSA",
"querystring": { "page":"dashboard", "dashboard":"default" }
},

or from the role startup information (from TA_permissions.js).


{
RoleId: "GB_Supervisor",
RoleDescription: "GB Supervisor",
Startup: "CSA",
StartupParameters: { page: "dashboard", dashboard: "default" },
...
}

Attributes available to describe each card are as follows:

AttributeExampleMandatory?Description
index0mandatoryunique index for card
element'dashboard-chart'mandatorycustom element to render - possible values: dashboard-chart, dashboard-table, dashboard-squares, dashboard-links, dashboard-pending-approvals
width4mandatorywidth of tile in twelfths of a screen (1-12)
cardTitle'New contracts'mandatorytitle for dashboard card
cardMinHeight'380px'optionalminimum height for card
drilldownType'customer'optionaltype of drilldown to perform if an item within a chart or table is clicked
apiEndpoint'http://a.com/api1'optionalAPI endpoint to retrieve data
apiMethod'GET'optionalHTTP Method to use for API call
apiPayload{x:'y'}optionalPayload to send if using PUT or POST methods
predicateApiEndpoint'http://a.com/api1'optionalAPI endpoint to retrieve predicate data - dashboard-squares,chart only
predicateApiMethod'GET'optionalHTTP Method to use for API call - only GET supported - dashboard-squares,chart only
predicateApiPayload{x:'y'}optionalPayload to send if using PUT or POST methods - dashboard-squares,chart only
predicateFunctionName'IsHighIncome'optionalfunction name that analyses the predicate response and determines if it is appropriate to show the apiEndpoint response (returns boolean) - dashboard-squares,chart only
valueArrayAttribute'value'optionalname of the attribute in the response that holds the array of results (usually 'value' for analytics APIs)
sortFieldname'Dates'optionalAttribute to sort results by
sortDirection'DESC'optionalSort direction if sortFieldname specified 'ASC' or 'DESC'
sortDatatype'NUMERIC'optionalEnable sort to be numeric rather than alphabetic
valueFieldnames['AvgDriverWeight']optionalFor dashboard-chart, array of response fieldnames to form the various series for the chart. If not specified, dataProcessingFunctionNames is required
labelFieldname'DriverNameValue'optionalFor dashboard-chart, Response attribute to use for x-axis labels. If not specified, xAxisCategoriesFunctionName is required
dataProcessingFunctionName'dashboardCustomersData'depends on elementwindow["xxx"] function name to extract data for the element from the API response - e.g for dashboard-squares, dashboard-table or dashboard-links
dataProcessingFunctionNames['dashboardNewContractsPie']depends on elementarray of window["xxx"] function names to build each chart series from the API response - e.g. for dashboard-chart
xAxisCategoriesFunctionName'dashboardNewContractsXAxisCategories'optionalwindow["xxx"] function name to extract x-axis categories for a chart from the API response
translateLabelstrueoptionalShould dashboard-chart labels be translated? Default = false
highchartsOptions{ see Highcharts documentation }dashboard-chartoptions that amend highcharts default presentation
chartConfig{ see Highcharts documentation }dashboard-chartHighcharts chart config
chartData{ see Highcharts documentation }dashboard-chartHighcharts data config including empty array(s) which will be populated from the API via the processing function
linksConfig{linkColor, linkStyle}dashboard-linkscolour and style for links
linksData{title, icon, plugin, page, url}dashboard-linksdata for links
squaresConfig{gridWidth, titleVariant, titleColor, squareStyle}dashboard-squaresconfig for squares presentation

Custom javascript

Attributes valueFieldnames and labelFieldname define the name of the response within the valueArrayAttribute array if the chart is based on simple data that can be extracted without any processing or adjustment. Alternatiely, attributes dataProcessingFunctionName, dataProcessingFunctionNames and xAxisCategoriesFunctionName define the name of functions, attached to the window object, to be used to process the API response so that it is in a format acceptable to the Highcharts data attribute. These functions need to be defined either in the CSA customisation.js or held in the Generic Config Micro Service from the CUSTOMJSURL setting.

Example functions follow:

/**
* Dashboard - Product count chart - series 1 - API to chart series array converter function
* @param {*} data
* @returns array of numbers
*/
window["dashboardProductCountSeries1"] = (data) => {
let result = [];
try {
result = data.value.map((record) => {
return record.ProductCount;
});
} catch(err) {console.log(err);}
return result;
};

/**
* Dashboard - Product count chart - x axis - API to chart x-axis labels converter function
* @param {*} data
* @returns array of labels
*/
window["dashboardProductCountXAxisCategories"] = (data) => {
let result = [];
try {
result = data.value.map((record) => {
return record.NextBestProduct;
});
} catch(err) {console.log(err);}
return result;
};

Licence warning

Temenos are licenced globally to create and distribute Highcharts definitions for the dashboard-chart element. If a customer wishes to define their own charts they will have to obtain their own licence from Highcharts.