Hello @Akascape,
First of all, thank you for this widget, you try and make almost every widget that is needed to make a good app... Also, I hope you make other widgets in the future!
Everything is fine in this widget, only the calculation of percentages is a little wrong... For example, I noticed that if the output percentage is 3.8, the number 3.8 is rounded down to 3... This is wrong and should be 4.
This is your calculation code:
def draw_pie_chart(self, *args):
.
.
.
for value in self.values.values():
.
.
.
perc = int(value['value']/sum_ * 100)
When we have many tags in this widget, that method of rounding the numbers in the widget makes our chart no longer 100%... and it is less, when we add the percentage number of all the tags together.
A better solution is to round the numbers correctly with the following code:
def draw_pie_chart(self, *args):
.
.
.
for value in self.values.values():
.
.
.
perc = int(round(value['value']/sum_ * 100))
In this case, our chart, when we add the numbers of all the tags, is equal to: 100% ±1%
Hello @Akascape, First of all, thank you for this widget, you try and make almost every widget that is needed to make a good app... Also, I hope you make other widgets in the future! Everything is fine in this widget, only the calculation of percentages is a little wrong... For example, I noticed that if the output percentage is 3.8, the number 3.8 is rounded down to 3... This is wrong and should be 4. This is your calculation code:
When we have many tags in this widget, that method of rounding the numbers in the widget makes our chart no longer 100%... and it is less, when we add the percentage number of all the tags together. A better solution is to round the numbers correctly with the following code:
In this case, our chart, when we add the numbers of all the tags, is equal to: 100% ±1%