Customizing Dashboard View Chart Colors
Dashboard components in DirX Audit Manager Classic present fact and dimension values according to selected Color scheme. This chapter describes how to configure specific colors for specific fact and dimension values. It is required to have basic knowledge of JSON files.
This chapter describes customizable JSON files and how to:
-
Configure a new color scheme
-
Setup tenant specific JSON files
-
Configure custom colors
-
Configure colors for fact and dimension values
-
Reload JSON files and clear chart coloring cache
It also contains a reference to the DirX Audit Manager Classic Guide and sample JSON files.
Default Chart Coloring JSON Files
The default chart coloring JSON files are common for all tenants and are located in the following install_path/conf/colors folder.
-
color_scheme.json – contains a predefined color schemes for the component display; for example Ocean or Forest.
-
chart_colors.json – contains predefined configuration of colors to be used in Dashboard view charts. Colors depend on specified dashboard, chart, dimension or fact table and their value.
-
colors.json – contains customizable colors and their name to be reused in chart_colors.json
Configuring a New Color Scheme
Before modifying install_path/conf/colors/color_scheme.json make sure to back up the original file.
To add a new color scheme, open install_path/conf/colors/color_scheme.json in any text editor.
Easiest way to add a new color scheme is to copy an existing JSON node and modify in accordingly.
In this tutorial, we will copy Traffic lights color scheme.
Node to be copied and modified:
…
{
"schemeName": "TRAFFIC_LIGHTS",
"label": "Dashboard.widget.colorScheme.TRAFFIC_LIGHTS",
"description": "",
"disabled": false,
"defaultLabel": "Traffic lights",
"colors": [
"#00FF00",
"#FFF200",
"#FF0000"
]
},
…
Each color scheme JSON node contains these key-pair values:
-
schemeName – name of a color scheme
-
label – localization label
-
description – optional description
-
disabled – boolean value
-
defaultLabel – label to be used, when label is missing or cannot be found in properties file
-
colors – ordered array of colors in hexadecimal format, for more possible color input, check “Configuring Custom Colors” chapter
Modify the copied node as:
…
{
"schemeName": "NEW_COLOR_SCHEME",
"label": "Dashboard.widget.colorScheme.NEW_COLOR_SCHEME",
"description": "",
"disabled": false,
"defaultLabel": "New color scheme",
"colors": [
"#FF00FF",
"#00FFFF",
"#FFFF00"
]
},
…
Save the modified file. Optionally, you can use any JSON validator to make sure the modified file is valid. Modifications on this file have immediate effect in DirX Audit Manager Classic application.
All existing color schemes are localized using keys starting with the Dashboard.widget.colorScheme prefix from the install_path/conf/i18n/messages.properties localization bundle file. When you want to localize a new or custom color scheme label, you need to add a new localization key and an appropriate value (localized color scheme) to the localization bundle file. Note that when you add a new key to the localization bundle file, you must restart the Apache Tomcat service (DirX Audit Manager Classic container) for the modification to take effect.
Tenant Specific Chart Coloring JSON Files
Modifications and customizations in the following chapters could be also applied to default JSON files located at install_path/conf/colors. Modifications in default JSON files will be applied to all tenants. It is strongly recommended to keep backup of original JSON files, if you want to modify them.
Customizations in tenants specific JSON files have higher priority than defaults stored at install_path/conf/colors. Overall, always the most specific color will be used to represent value in a chart.
Setting Up Tenant Specific JSON Files
If you want to assign specific colors for specific facts and dimension in a specific tenant, it is necessary to create a folder that will contain customizable JSON files.
Copy folder chart_coloring_template containing two JSON files located at install_path/conf/colors to install_path/conf/tenants/tenantID/, where tenantID represents identification of the tenant you want to customize. Then rename the chart_coloring_template folder to chart_coloring. Modifications done to chart_colors.json and colors.json files in this location will be relevant only for the specific tenant.
It is also possible to copy and accordingly modify sample JSON files located at: install_media/Additions/Data/SampleChartColors/chart_coloring.
After this step, there should be a new folder in your installation path: install_path/conf/tenants/tenantID/chart_coloring containing chart_colors.json and colors.json.
Configuring Custom Colors
It is possible to configure new custom colors that may be reused multiple times without specifying the color using hexadecimal format #00FF00, RGB format (255, 0, 0) or java.awt.Color Color.BLUE constructor. Therefore, in case of any required changes to the customized color, it will not be necessary to modify it at multiple places. File to modify: install_path/conf/tenants/tenantID/chart_coloring/colors.json.
Example JSON node holding three custom colors:
…
"customColors": {
"Custom.My-Company_RED": "(255, 0, 0)",
"Custom.My-Company_GREEN": "#00FF00",
"Custom.My-Company_BLUE": "Color.BLUE"
},
…
It is necessary to use Custom. prefix for naming customized colors. These customized colors can be used when setting specific fact and dimension colors in the next chapter.
For testing purposes, modified JSON file might have this content:
{
"version": 1,
"data": {
"customColors": {
"Custom.TEST_RED": "(255, 0, 0)"
}
}
}
The configured color Custom.TEST_RED will be used in the following chapter, it represents RGB color value of (255, 0, 0), which is a red color.
Configuring Colors for Fact and Dimension Values
To configure colors for fact and dimension values, it is necessary to modify file located at: install_path/conf/tenants/tenantID/chart_coloring/chart_colors.json.
The JSON file contains two arrays, dimensions and facts.
Common key-pair values in their nodes are:
-
dashboardSpecific – array of dashboard names which these predefined colors will be used in, currently not supported and should be left as an empty array
-
chartSpecific – array of chart names which these predefined colors will be used in
-
tableSpecific – specific fact table, for example FCT_HST_USERS or dimension table, for example DIM_HST_OU in which these predefined colors will be used. If the value is set to “default”, colors will be used for all fact or dimension tables
-
valueColor – node containing values and their assigned colors
Example JSON node holding dimension colors for specific chart, dimension table and values:
…
"dimensions": [
{
"dashboardSpecific": [],
"chartSpecific": [
"hst__dxi__users__total__datemonth_dxrstate"
],
"tableSpecific": "DIM_HST_OU",
"valueColor": {
"Product Testing": "Custom.My-Company_RED",
"Finances": "Custom.My-Company_GREEN",
"Information Technology": "Custom.My-Company_BLUE"
}
},
]
…
Example JSON node holding fact colors that will be applied to all fact tables:
…
"facts": [
{
"dashboardSpecific": [],
"chartSpecific": [],
"tableSpecific": "default",
"valueColor": {
"FCT_TOTAL": "Color.BLUE",
"FCT_SUCCEEDED": "#00FF00",
"FCT_FAILED": "(255, 0, 0)"
}
},
]
…
For testing purposes, modified JSON file might have this content:
{
"version": 1,
"data": {
"dimensions": [
{
"dashboardSpecific": [],
"chartSpecific": [],
"tableSpecific": "DIM_HST_OU",
"valueColor": {
"Information Technology": "Custom.TEST_RED"
}
},
{
"dashboardSpecific": [],
"chartSpecific": [],
"tableSpecific": "default",
"valueColor": {
"No value": "(0, 0, 0)"
}
}
],
"facts": [
{
"dashboardSpecific": [],
"chartSpecific": [],
"tableSpecific": "FCT_HST_USERS",
"valueColor": {
"FCT_HST_TOTAL": "Color.YELLOW"
}
},
{
"dashboardSpecific": [],
"chartSpecific": [],
"tableSpecific": "default",
"valueColor": {
"FCT_HST_TOTAL": "Color.GREEN"
}
}
]
}
}
In dimensions node, there are colors set for dimension table “DIM_HST_OU”. The value Information Technology will be represented by red color, as in previous chapter Custom.TEST_RED was configured as such. Next node sets color of value No value to black color, it will be applied to all dimension tables, as tableSpecific attribute is set to default.
In facts node, fact FCT_HST_TOTAL in fact table “FCT_HST_USERS” should be represented by yellow color.
Fact FCT_HST_TOTAL should be represented by green color in all other fact tables, as tableSpecific attribute is set to default.
See the chapter “Dashboard Data in DirX Audit Manager Classic” in the DirX Audit Administration Guide for more information about facts, dimensions, fact tables and components.
To test changes after modifying JSON files, you can either logout and login back to the DirX Audit Manager Classic application or use the refresh button in top right corner in the Dashboard view tab. The refresh button will reload JSON files and clear cached colors. For details on how to use the Dashboard view, see the section “Using the Dashboard View” in the DirX Audit Manager Classic Guide.
In the Dashboard view, add component Risk users based on overall risk by month and risk level and open component settings. The Fact table should be set as Users (HST), Chart class should be 1 fact 2 dimensions. Set second dimensions from Risk level to Organizational unit and press OK. Value Information technology should be represented by red color and No value by black color as is set in the chart_colors.json file.
To test colors of facts, open component settings and change the Chart class to 1 fact 1 dimension and make sure that Total is selected as a Facts, proceed with OK. Total number of users should be represented by yellow color, as is set specifically for “FCT_HST_USERS” fact table.
To check default color of “FCT_HST_TOTAL” fact, add component DirX Identity total history account entries by month and state, open component settings, Fact table should be set as Accounts (HST), change Chart class to 1 fact 1 dimension and Facts to Total. After pressing OK total number of accounts should be represented by green color.