DDX Mapbox cluster


I am using a mapbox ddx cluster for one of my dashboards.

Now by default, mapbox is taking three value from the data source, lat coordinates, lng coordinates and a value. When the combined together as a group and then it shows on map. And the further we zoom in, the value become split according to that specific coordinates.

Now My case is little bit different, my data have another value column(risk_levels) as same as with the value column on those same rows too. And I want to show the count inside the donut as the value same which is already showing, but now I want to divide the donut cluster into segments according to the risk_levels. It means that if risk level are available, donut will show its full value count in the middle and the risk value divisions on the outside of donut cluster.

I am unable to do this. I tried to add the risk_level value inside properties, which is being used to show the total count.

But when I tried to access the risk level value, its not coming as groups as other values are already in the features object after we map them on querySourceFeatures. Belowis the example how I am getting the risk level value but not coming in object

Below is my resultant, which is right now showing total value count in the middle. Also the segments are right now showing the divisions of those counts. Not risk level. I need to show segments according to risk level count on outside and total value count inside.