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
648 stars 48 forks source link

[BUG] Can't plot Line Chart with only values below 1.0 #26

Closed henricazottes closed 3 years ago

henricazottes commented 3 years ago

Describe the bug Having a line chart with values exclusively under 1 make it fail to plot.

To Reproduce Steps to reproduce the behavior:

  1. Link a LineChart
  2. Add this script to parent node:
    
    extends Control

func _ready(): var initial_data: Array = [ ["Time","Alt"], ["1.0","0.0"], ["2.0","0.0"], ["3.0","0.5"] ] $LineChart.plot_from_array(initial_data)


3. Run the game
4. See error: Division by zero in operator "/" :

Changing last data with `["3.0", "1.5"]` make it works.

**Expected behavior**
We should have a minimal size plot that can handle values below 1.

**Screenshots**
![image](https://user-images.githubusercontent.com/5214384/101522957-3ad05780-3988-11eb-91b1-7d94de916729.png)

**Desktop (please complete the following information):**
 - OS: Elementary OS
 - Godot Engine Version 3.2.3.stable
- Plugin Version 0.4.2
fenix-hub commented 3 years ago

Hi @henricazottes , Sorry it took that long. Next PR will fix this issue. Here's an example:

Code:

var initial_data : Array = [
    ["Time","Alt","Alt2"],
    [1.0, 1.0, 0.25],
    [2.0, 0.0, 0.05],
    [3.0, 0.5, 5.5],
    ]

func _ready():
    $LineChart.plot_from_array(initial_data)

Related pic: WWN7KFXzNC