RadzenDonut Series display error when items in collection are zero

Hi, I am currently using a RadzenDonutSeries inside my Blazor Server(.net6) for displaying my data.

I noticed in de browser dev tool that an error is thrown each time all my items in the given collection have a value of zero.

This error isnt thrown as soon as the chart has at least one item for displaying. Reading off the given error it looks like the chart is trying to draw the actual donut parts, but it cant because the collection it's getting contains no items for displaying e.g. the given values are zero. Thus it has no default to fall back to like just a empty circle for example. It currently only displays the text inside the donut body and the legend as shown in the following example:
image

The collection i currently use consist of a List containing a string and the given ammount of occurnces of said categorie that are created in a class of mine.
Example item in List:{Categorie = "Cat1", Ammount = 5}
The Chart works perfectly when given at leaste one item where the 'ammount' is 1 or higher

I cant share my actual code, so for demonstration purposes I have setup the following example that looks like the one i am currently using. (You will find the code in my second message)

I tried looking up if somebody else experienced the same problem but didnt find anything. Sorry if this is a duplicate question.

Luckily the error doens't break my program but i found it strange no the less that it doenst have a fall back method in wich it only displays a the edge of an empty circle.

I also tried it on a regular piechart and it gives the same error so i presume this has somthing to do with the way Radzencharts are drawn.

Would it be possible to add a default check to the donut and piecharts to display an empty circle as a feature in a next version of Radzen?

Thanks for you time.

With kind regards,

Connor

The example code as stated earlier.

Hi @Mr.Prog,

How does the test data look like? The provided code doesn't include that important information.

Hi @korchev Thanks for your fast reply.

Given the example the test data would look like this:

IList myList() = new list() {
new Assignment(){Categorie = "Cat1", Ammount = 0},
new Assignmen(){Categorie = "Cat1", Ammount = 0}
};

The GetAssignmentAmmount(); returns the list that is build like the example above

the Assignment model that is used looks like this:

public string Categorie {Get; Set;}
public int Ammount {Get; Set;}

The objects in the list are added based on records in my DB. The Assignment class counts the amount of occurrences of "open" and "closed" assignments based on all the records inside the DB. So the amount of open or closed assignments could be equel to zero since all assignments could be finished depending on the time of month.

A example would be that at the beginning of the month the list would look like {"Cat1",0},{"Cat2",0}
during the month it could look like {"Cat1",5},{"Cat2",10} (Read as 5 open tasks and 10 finished tasks)
and at the end of the month it would look like {"Cat1",0},{"Cat2",15}.

The charts work perfectly wel as long as one of the "ammount" objects in the list is equel to 1 or higher.
it also doenst break the website when the data is updated. the only thing that happens is that the Developer tool in the browser would show the error each time the ammounts hit zero.

I hope this clarifies your question.

Hi @korchev,

I saw that the Radzen demo components now have a live edit feature (nice BTW).

So i tested out if it would give the same error as shown in my earlier post.

As you can see the error is also thrown in the demo version of the donut series component, when setting the 'Revenue' amount to Zero. I also tested this on other browsers like Edge, Brave and Chrome and the same behavior is seen across different browsers. Out of curiosity I also tested this on the pie chart series and the same error is thrown.

Below you can see what i changed in the source code in the demo of the donut series component.

I presume this isn't the expected behavior it should give?

In my case I would expect a default fall back to be an empty donut (only the outer rim is shown) without any fill in to show that there is no data to display.

Would it be possible to add a default fall back feature to the donut and pie chart components when the given values are zero in a future Radzen update?

Hi @Mr.Prog,

Feel free to open a new github issue in our repository. As a workaround you can just hide the chart when all series are 0.

For reference for anybody looking for the rapported GitHub issue

The problem surrounding donut charts + piecharts has been resolved in the latest build: 4.7.1.

Thanks for your help @korchev @Paul_Ruston.