How to set the height dynamically in RadzenChart

Hi,

How to set the height dynamically when we have more/less records to shown in RadzenChart control with RadzenBarOptions.
The below image is displaying correctly If I set the RadzenChart height as 1200px with many items(20 - 30 items) shown.

If we have the less items to display(1-10 items) with the same RadzenChart height as 1200px the charts looks ugly with more empty space between the bars as shown below image.

How do I set the height from 1200px to 500px if we have less items.

I try with the below option it was not working.

Regards,
P.Sathish kumar

Just use some formula for the height based on the number of items e.g.
var height = myData.Count() * 50;

Sorry in the previous post I missed to add the code...(style="height: @ChartHeight").Calculate height is good but how do we assign that height dynamically to the Style attribute like the above?

You can use C# string interpolation:

style=@($"height: {ChartHeight}")

Great...That works as expected thank you very much :slight_smile: