Fix clearing of data structures with multiple calls to plot_from_x

This commit is contained in:
Jorge 2021-05-03 18:15:19 +02:00
parent cd5b296eda
commit e6914a82a4
2 changed files with 9 additions and 1 deletions

View File

@ -342,6 +342,8 @@ func plot():
emit_signal("chart_plotted",self) emit_signal("chart_plotted",self)
func plot_from_csv(csv_file : String, _delimiter : String = delimiter): func plot_from_csv(csv_file : String, _delimiter : String = delimiter):
clean_variables()
clear_points()
load_font() load_font()
PointData.hide() PointData.hide()
@ -387,7 +389,6 @@ func plot_from_dataframe(dataframe : DataFrame) -> void:
clean_variables() clean_variables()
clear_points() clear_points()
load_font() load_font()
load_font()
PointData.hide() PointData.hide()
data = dataframe.get_dataframe().duplicate(true) data = dataframe.get_dataframe().duplicate(true)

View File

@ -384,6 +384,13 @@ func generate_identifier():
func structure_datas(database : Array): func structure_datas(database : Array):
# @labels_index can be either a column or a row relative to x values # @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 # @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 are_values_columns = invert_chart != are_values_columns
var x_values := [] var x_values := []