Template - Charts
UPDATED: Please head over to our new GitHub Support Site for help, examples, tips and tricks: https://github.com/AttackForge/ReportGen
You can add charts to your reports. The following charts are supported in ReportGen v2.5.4 or above.
Pie chart
Bar chart
Pie Chart
Example 1: Pie Chart showing unique vulnerabilities
This example will produce a pie chart using data from existing tags e.g. {totalCriticalVulns}, {totalHighVulns}, etc. to populate the values in the chart.
The following chart is produced:
Example 2: Pie Chart using data from custom variables
This example will produce a pie chart for unique 'Internal Findings'. This example uses filters and functions in order to pre-calculate 'Internal Findings' into variables, then refers to these variables in the chart to populate the values in the chart.
This example uses custom tags to filter 'Internal Findings'. If you are not sure how to use custom tags, please check custom tags page for more details.
The following chart is produced:
Example 3: Donut Pie Chart showing unique vulnerabilities
The example will produce a donut pie chart using data from existing tags e.g. {totalCriticalVulns}, {totalHighVulns}, etc. to populate the values in the chart. It sets the "inner_radius" to a value to create the donut hole in the center of the chart.
The following chart is produced:
Configuration Options
type (required): pie.
name (required): must be unique name for the chart. String.
options (required)
inner_radius (optional): used to create a donut chart. Sets the radius of the inner white circle. Number. Default is 0.
title (optional): display a title above the chart. String.
title_font_size (optional): sets font size for title. Number. Default is 18.
title_offset (optional): sets the distance between the title and the top boundary. Number. Default is 25.
labels_inside_chart (optional): includes labels inside chart. true or false. defaults to false.
data (required)
names (required): labels for each of the sections within the chart. List of strings.
names_font_size (optional): sets font size for names. Number. Default is 14.
values (required): data for each of the sections within the chart. List of strings, numbers, %(scope), $(variables).
values_font_size (optional): sets font size for values. Number. Default is 14.
colors (optional): colors to assign for each value. Supports hex codes and system color names. List of strings. Default is black.
width (optional): sets width of chart in pixels. Number. Default is 640.
height (optional): sets height of chart in pixels. Number. Default is 400.
margin (optional)
top (optional): sets the distance between the top of the chart, and the top boundary. Number. Default is 0.
bottom (optional): sets the distance between the bottom of the chart, and the bottom boundary. Number. Default is 0.
left (optional): sets the distance between the left-end of the chart, and the left boundary. Number. Default is 0.
right (optional): sets the distance between the right-end of the chart, and the right boundary. Number. Default is 0.
Bar Chart
Example 1: Horizontal Bar Chart showing unique vulnerabilities
This example will produce a horizontal bar chart using data from existing tags e.g. {totalCriticalVulns}, {totalHighVulns}, etc. to populate the values in the chart.
The following chart is produced:
Example 2: Vertical Bar Chart showing unique vulnerabilities
This example will produce a vertical bar chart using data from existing tags e.g. {totalCriticalVulns}, {totalHighVulns}, etc. to populate the values in the chart.
The following chart is produced:
Example 3: Bar Chart using data from custom variables
This example will produce a horizontal and vertical bar chart for unique 'Internal Findings'. This example uses filters and functions in order to pre-calculate 'Internal Findings' into variables, then refers to these variables in the chart to populate the values in the chart.
This example uses custom tags to filter 'Internal Findings'. If you are not sure how to use custom tags, please check custom tags page for more details.
The following chart is produced:
Switching horizontal to vertical will produce the following:
Configuration Options
type (required): bar.
name (required): must be unique name for the chart. String.
options (required)
orientation (required): must be vertical or horizontal. String.
title (optional): display a title above the chart. String.
title_font_size (optional): sets font size for title. Number. Default is 18.
title_offset (optional): sets the distance between the title and the top boundary. Number. Default is 25.
data (required)
names_label (optional): sets a label for the names. String.
names_label_font_size (optional): sets font size for the names label. Number. Default is 18.
names_label_offset (optional): sets the distance between the names label and the left-boundary (for horizontal charts) or bottom-boundary (for vertical charts). Number. Default is 5 for vertical bar chart and 15 for horizontal bar chart.
names (required): labels for each of the bars within the chart. List of strings.
names_font_size (optional): sets font size for names. Number. Default is 10.
values_label (optional): sets a label for the values. String.
values_label_font_size (optional): sets font size for the values label. Number. Default is 18.
values_label_offset (optional): sets the distance between the values label and the bottom-boundary (for horizontal charts) or left-boundary (for vertical charts). Number. Default is 15 for vertical bar chart and 5 for horizontal bar chart.
values (required): data for each of the bars within the chart. List of strings, numbers, %(scope), $(variables)
values_font_size (optional): sets font size for values. Number. Default is 10.
colors (optional): colors to assign for each value. Supports hex codes and system color names. List of strings. Default is black.
y_axis_increase_ticks_by_percentage (optional): For vertical bar charts, increase the y-axis by a percentage.
width (optional): sets width of chart in pixels. Number. Default is 640.
height (optional): sets height of chart in pixels. Number. Default is 400.
margin (optional)
top (optional): sets the distance between the top of the chart, and the top boundary. Number. Default is 50.
bottom (optional): sets the distance between the bottom of the chart, and the bottom boundary. Number. Default is 50.
left (optional): sets the distance between the left-end of the chart, and the left boundary. Number. Default is 50.
right (optional): sets the distance between the right-end of the chart, and the right boundary. Number. Default is 0 for vertical charts and 10 for horizontal charts.
Last updated