# new Dashboard(config)
Its a Custom Web Component. Do not use the constructor directly with the new keyword. Instead, use one of the following methods:
Create the Web Component and call its init method:
const myDashboard = document.createElement("a-dashboard").init(config)
Or use the shorthand for it:
const myDashboard = createDashboard({
id: "my-dashboard",
collection: kiss.app.collections["opportunity"]
})
myDashboard.render()
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
config |
object
|
||
name |
string
|
The dashboard title. We use the "name" property instead of "title" to be consistent with all view names. |
|
collection |
Collection
|
The data source collection |
|
record |
object
|
<optional> |
Record to persist the view configuration into the db |
canEditView |
boolean
|
<optional> |
true if the user can edit the view setup. Default is true. |
useCDN |
boolean
|
<optional> |
Set to false to use the local version of ChartJS. Default is true. |
this
Generated markup
<a-dashboard class="a-dashboard">
<div class="dashboard-header">
<div class="dashboard-title">
<!-- Dashboard title -->
</div>
<div class="dashboard-toolbar">
<!-- Dashboard toolbar items -->
</div>
</div>
<div class="dashboard-container">
<!-- Embedded charts -->
</div>
</a-dashboard>
Methods
# _showGroupSetup(groupId, event)
Show the menu to setup a group of charts
Parameters:
Name | Type | Description |
---|---|---|
groupId |
string
|
|
event |
object
|
The click event |
# async addChart(groupId)
Add a chart to a group of charts
Parameters:
Name | Type | Description |
---|---|---|
groupId |
string
|
this
# checkGroupMove(groupId) → {object}
Checks whether a group can be moved up or down.
Parameters:
Name | Type | Description |
---|---|---|
groupId |
string
|
The ID of the group to check. |
- An object with
up
anddown
properties indicating the possible moves.
object
# async deleteChart(chartId)
Remove a chart from the dashboard
Parameters:
Name | Type | Description |
---|---|---|
chartId |
string
|
The chart ID to remove |
this
# async deleteGroup(groupId)
Delete a group of charts from the dashboard
Parameters:
Name | Type | Description |
---|---|---|
groupId |
string
|
The group ID to delete |
# getChart(chartId) → {HTMLElement}
Get a chart from its ID
Parameters:
Name | Type | Description |
---|---|---|
chartId |
string
|
- The chart element
# getChartIndexInGroup(chartId) → {number}
Get the index of a chart in a group
Parameters:
Name | Type | Description |
---|---|---|
chartId |
string
|
- The chart index in the group
number
# getConfig() → {Array.<object>}
Get the current dashboard configuration
- The dashboard configuration, as an array of groups of charts
Array.<object>
# getGroupCharts(groupId) → {Array.<HTMLElement>}
Get the charts of a group
Parameters:
Name | Type | Description |
---|---|---|
groupId |
string
|
- The charts of the group
# getGroups() → {Array.<HTMLElement>}
Get the groups of the dashboard
- The groups of charts (1 group = 1 row in the dashboard)
# moveChart(chartId, targetChartId)
Move a chart to another position in the dashboard
Parameters:
Name | Type | Description |
---|---|---|
chartId |
string
|
|
targetChartId |
string
|
this
# moveGroupDown(groupId)
Move a group down in the dashboard
Parameters:
Name | Type | Description |
---|---|---|
groupId |
string
|
this
# moveGroupUp(groupId)
Move a group up in the dashboard
Parameters:
Name | Type | Description |
---|---|---|
groupId |
string
|
this
# async print()
Print the dashboard - Work in progress
# setColor(color)
Set the color of the dashboard (mainly buttons at the moment)
Parameters:
Name | Type | Description |
---|---|---|
color |
string
|
this