Format Value in Chart

I am new to Blazor and Radzen, so please forgive me if this is something obvious.

I would like to display a Pie Chart. The chart display the storage size used by database.

I have a method to format the 'int' of number of bytes used, and the method to convert the number to a nice string (like 'xx Gb') ; but I cannot find how I can use my method in this chart.

The same technique can be used in your case as well:

Hi @enchev ,

thanks for your answer. I am not sure on how I could do it.

Here is my razor

                    <RadzenChart>
                        <RadzenPieSeries Data="@_collectionStorageSummaries" Title="Collections" CategoryProperty="Name" ValueProperty="Size" ColorScheme="Palette">
                            <RadzenSeriesDataLabels Visible="true" />
                        </RadzenPieSeries>
                    </RadzenChart>

And I have a dedicated class for the computed storage :


    protected class StorageSummary
    {
        public string Name { get; set; }

        public long Size { get; set; }
        
        public string SizeFriendly { get; set; }
    }

    static string ToSizeFriendly(long value)
    {
        xxxxxx
    }

I already have the property with the friendly display of the value.
My point is : How can I pass the 'int' value to the chart to have the right chart display, and pass also the friendly string, to have the labels applied to humanly understand the values.

I don't see Formatter or Template for this.

I have found another post on the forum and by looking at the code of the PieSeries on Github, I found a way :

                    <RadzenChart ColorScheme="ColorScheme.Palette">
                        <RadzenPieSeries Data="@_indexStorageSummaries" Title="Indexes" CategoryProperty="Name" ValueProperty="Size">
                            <RadzenSeriesDataLabels Visible="true"/>
                            <RadzenValueAxis Formatter="@ToSizeFriendly" />
                        </RadzenPieSeries>
                    </RadzenChart>