fenix-hub / godot-engine.easy-charts

A Godot Engine addon for plotting general purpose charts. A collection of Control, 2D and 3D Nodes to plot every chart possible.
MIT License
647 stars 48 forks source link

[BUG] Issue when having two values in PieChart they overlap each other #105

Open EiTaNBaRiBoA opened 6 months ago

EiTaNBaRiBoA commented 6 months ago

Describe the bug when setting var y: Array = ["Java", "JavaScript"] and var x: Array = [5, 6] the percentage of the numbers overlap each other image

To Reproduce Steps to reproduce the behavior: Go to the piechart example, edit control.gd script and change the x,y values var y: Array = ["Java", "JavaScript"] var x: Array = [5, 6]

Expected behavior Numbers not being overlapping

Desktop (please complete the following information):

AmyGilhespy commented 6 months ago

Looking at the code, this happens anytime an arc is larger than (or equal to?) PI radians, because pie_plotter.gd, line 64: var mid_point: Vector2 = (slice[-1] + slice[1]) / 2 doesn't take into account slices that are larger than a half circle. I have confirmed this with the data [1, 2, 3, 10] in the example:

image