Dynamic Chart Series with Nested Dictionary?

I'm trying to use the Radzen Charts with dynamic series as shown in this example:

https://forum.radzen.com/t/adding-removing-radzenlineseries-to-radzenchart-from-code-behind/5629/2?u=db1234

My data is in a nested Dictionary:

Dictionary<string, Dictionary<string, int>> myData = new Dictionary<string, Dictionary<string, int>>();

So far, this is what I have:

            <RadzenChart>
                @foreach (var myDataItem in myData)
                {
                    <RadzenLineSeries Data="@myDataItem.Value"
                              Title="@myDataItem.Key"
                              CategoryProperty="@(((Dictionary<string, int>) myDataItem.Value).Keys)"
                              ValueProperty="@myDataItem.Value.Select(x => x.Value).ToString()" />
                }
            </RadzenChart>

"myDataItem.Key" represents the Parent Dictionary's Key, and is set to the Title of each Series.

But for CategoryProperty and ValueProperty, I cannot seem to find the right syntax to access the Key and Value of the Child Dictionary.

I've also tried "myDataItem.Value.Key" but that doesn't work either.

Does anyone have any idea that could help?

I think I have it now.

Since the "Data" value is the Child Dictionary, the "CategoryProperty" and "ValueProperty" fields can refer directly to it.

So here it is working:

            <RadzenChart>
                @foreach (var myDataItem in myData)
                {
                    <RadzenLineSeries Data="@myDataItem.Value"
                              Title="@myDataItem.Key"
                              CategoryProperty="Key"
                              ValueProperty="Value" />
                }
            </RadzenChart>

Indeed CategoryProperty and ValueProperty should be properties of the items of Data. In your case Data is set to IDictionary<> and its items are of type KeyValuePair. So you use the Key and Value properties as CategoryProperty and ValueProperty.