Charts are a type of Insight that can be added to any sidebar widget using metadata configuration.
This configuration can be added to the
detaiviewdefs of the module you want to add it to.
At the moment there are only 3 chart types available to use:
Other chart types will be added in the future. It is also possible to implement your own custom char type. Towards the end of this page you’ll find documentation on it.
The following code snippet takes an example from the Accounts module
For more examples of configurations you can look at:
$viewdefs['Opportunities'] = [
'ListView' => [
'sidebarWidgets' => [
'opportunities-by-sales-stage-price' => [
'type' => 'chart',
'labelKey' => 'LBL_QUICK_CHARTS',
'options' => [
'toggle' => true,
'headerTitle' => false,
'charts' => [
'chartKey' => 'opportunities-by-sales-stage-price',
'chartType' => 'horizontal-bar',
'statisticsType' => 'opportunities-by-sales-stage-price',
'labelKey' => 'PIPELINE_BY_SALES_STAGE',
'chartOptions' => [
'acls' => [
'Opportunities' => ['view', 'list']
From the example above we can see that charts have different options when configuring. Within the
options array, we can
see that it then displays
toggle, this is to show the dropdown with the name of the chart and also allow changing
You may also see within the
options array there is another array called
charts. Within this array there is;
Some of these are simple in meaning.
chartKey is just the name given to the chart to make it individual, 'chartType' is
they type of chart you would like to display. Some other options for this would include: pie-grid-chart, line-chart, vertical-bar-chart
labelKey is also just the label shown within the chart.
statisticsType option, this is how each chart gets it’s data, you are able to see each statistic file within the
core/modules/<module> directory, this key links to a specific service within the statistics API.