Documentation & Chartjs Issues #84
-
I understand the format for calling those variables created in the design tab and applying them to objects like tables. The tables that come in the precanned work great. The one feature I really like and I am trying to get ported over to a scatter plot is the CVSS score. When "findings.cvss.score" is called on a table the integer CVSS score is displayed just fine. But if when I call that same score in a chartjs it errors out. Can you revamp documentation pertaining to how chartjs is implemented with sysreptor? Also, explain/help me understand why that data point cannot be called in a chart object? Thank you. Sample input:
The compilation error is: "TypeError: Cannot read properties of undefined (reading 'score')" |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, the variable "findings" contains a list of finding objects. The table in the demo design iterates over the list with a for-loop and creates an iteration variable called "finding" (without "s" at the end). <tr v-for="finding in findings"> In your code snippet, you are trying to access the per-finding properties on the list. Instead, you need to iterate over the list and map each finding to its CVSS score to use them in the chart. You can use JS Array functions datasets: [{ data: findings.map(f => f.cvss.score) }] |
Beta Was this translation helpful? Give feedback.
Hi,
the variable "findings" contains a list of finding objects. The table in the demo design iterates over the list with a for-loop and creates an iteration variable called "finding" (without "s" at the end).
In your code snippet, you are trying to access the per-finding properties on the list. Instead, you need to iterate over the list and map each finding to its CVSS score to use them in the chart. You can use JS Array functions
map
andfilter
for that. I don't know how your chart should look like, but you might need something like: