To create a new Dynamic Chart, it’s easiest to copy an existing one as a baseline and make your changes as necessary. To see what a Dynamic Chart record looks like, navigate to VividCharts > Dynamic Charts and click into Donut - Incidents by category based on current user. Here, you’ll see various options under the Chart Options tab. Click to the Script tab and you’ll see that this script is leveraging the Service Portal Util scripts, in particular: $sp.getParameter('sys_id');. Since this script will be run on the Service Portal widget’s server script we can use Service Portal features. Here, we’re grabbing the URL parameter ‘sys_id’ and creating a GlideAggregate call off of it.
When creating your own Dynamic Chart, pay attention to what format the data needs to be that’s being pushed into the chartData array. This data schema is what the Dynamic Chart widget will be expecting.