From e6914a82a4571c1ca2a1976a520de40ed6a7fd1a Mon Sep 17 00:00:00 2001 From: Jorge <63685920+JFerrerBeired@users.noreply.github.com> Date: Mon, 3 May 2021 18:15:19 +0200 Subject: [PATCH] Fix clearing of data structures with multiple calls to plot_from_x --- addons/easy_charts/Utilities/Scripts/chart.gd | 3 ++- addons/easy_charts/Utilities/Scripts/scatter_chart_base.gd | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/easy_charts/Utilities/Scripts/chart.gd b/addons/easy_charts/Utilities/Scripts/chart.gd index a370dd8..6abd214 100644 --- a/addons/easy_charts/Utilities/Scripts/chart.gd +++ b/addons/easy_charts/Utilities/Scripts/chart.gd @@ -342,6 +342,8 @@ func plot(): emit_signal("chart_plotted",self) func plot_from_csv(csv_file : String, _delimiter : String = delimiter): + clean_variables() + clear_points() load_font() PointData.hide() @@ -387,7 +389,6 @@ func plot_from_dataframe(dataframe : DataFrame) -> void: clean_variables() clear_points() load_font() - load_font() PointData.hide() data = dataframe.get_dataframe().duplicate(true) diff --git a/addons/easy_charts/Utilities/Scripts/scatter_chart_base.gd b/addons/easy_charts/Utilities/Scripts/scatter_chart_base.gd index a03d6a1..64ef5db 100644 --- a/addons/easy_charts/Utilities/Scripts/scatter_chart_base.gd +++ b/addons/easy_charts/Utilities/Scripts/scatter_chart_base.gd @@ -384,6 +384,13 @@ func generate_identifier(): func structure_datas(database : Array): # @labels_index can be either a column or a row relative to x values # @y_values can be either a column or a row relative to y values + + #This is done to make sure this arrays are empty on subsecuent calls of this function. + #This function is called from the "old" methods such as plot_from_array and + #for the moment it doesn't clean this variables on clean_variable. + x_domain = [[], []] + y_domain = [[], []] + are_values_columns = invert_chart != are_values_columns var x_values := []