diff --git a/addons/easy_charts/utilities/classes/base/scatter_chart_base.gd b/addons/easy_charts/utilities/classes/base/scatter_chart_base.gd index d9e8b6a..556053a 100644 --- a/addons/easy_charts/utilities/classes/base/scatter_chart_base.gd +++ b/addons/easy_charts/utilities/classes/base/scatter_chart_base.gd @@ -315,6 +315,8 @@ func _slice(): y_data.pop_front() func update_functions(new_x, new_y : Array, param_dic : = {}) : + assert(new_y.size() == y_labels.size(), + "new values array size (%s) must match Labels size (%s)"%[new_y.size(), y_labels.size()]) _slice() x_values.append(new_x) @@ -328,16 +330,13 @@ func update_functions(new_x, new_y : Array, param_dic : = {}) : func update_function(id: String, new_x, new_y, param_dic := {}) -> void: - _slice() - if only_disp_values.x < x_values[0].size(): - x_values.pop_front() - x_values.append(new_x) var function = y_labels.find(id) if function == -1: #Not found ECUtilities._print_message("The identifier %s does not exist." % id,1) return + _slice() for y_data_i in range(0, y_datas.size()): if y_data_i == function: y_datas[y_data_i].append(new_y) else: y_datas[y_data_i].append(y_datas[y_data_i][y_datas[y_data_i].size()-1]) diff --git a/addons/easy_charts/utilities/classes/structures/data_frame.gd b/addons/easy_charts/utilities/classes/structures/data_frame.gd index f903724..ec62c29 100644 --- a/addons/easy_charts/utilities/classes/structures/data_frame.gd +++ b/addons/easy_charts/utilities/classes/structures/data_frame.gd @@ -31,13 +31,13 @@ func build_dataset(data : Array, headers : PoolStringArray, labels : PoolStringA return dataset func insert_column(column : Array, header : String = "", index : int = dataset[0].size() - 1) -> void: - assert(column.size() == datamatrix.rows() if not datamatrix.empty() else labels.size(), "error: the column size must match the dataset column size") + assert(column.size() == (datamatrix.rows() if not datamatrix.empty() else labels.size()), "error: the column size must match the dataset column size") headers.insert(index, header if header != "" else MatrixGenerator.get_letter_index(index)) datamatrix.insert_column(column, index) dataset = build_dataset_from_matrix(datamatrix, headers, labels) func insert_row(row : Array, label : String = "", index : int = dataset.size() - 1) -> PoolStringArray: - assert(row.size() == datamatrix.columns() if not datamatrix.empty() else headers.size(), "error: the row size must match the dataset row size") + assert(row.size() == (datamatrix.columns() if not datamatrix.empty() else headers.size()), "error: the row size must match the dataset row size") labels.insert(index, label if label != "" else str(index)) datamatrix.insert_row(row, index) dataset = build_dataset_from_matrix(datamatrix, headers, labels)