update dataframe plotting

This commit is contained in:
fenix-hub 2022-01-10 18:19:59 +01:00
parent 0d44e72b7c
commit 2303617e90
2 changed files with 6 additions and 2 deletions

View File

@ -355,6 +355,8 @@ func plot_from_source(file : String, _delimiter : String = delimiter) -> void:
plot(read_data(file, _delimiter)) plot(read_data(file, _delimiter))
func plot_from_dataframe(dataframe : DataFrame) -> void: func plot_from_dataframe(dataframe : DataFrame) -> void:
assert(dataframe.headers.size() > 1 or dataframe.labels.size() > 1,
"Cannot plot a dataframe of size %sx%s"%[dataframe.headers.size(), dataframe.labels.size()])
self.dataframe = dataframe self.dataframe = dataframe
plot(dataframe.get_dataset()) plot(dataframe.get_dataset())

View File

@ -478,8 +478,10 @@ func count_functions():
# Calculate distance in pixel between 2 consecutive values/datas # Calculate distance in pixel between 2 consecutive values/datas
func calculate_pass(): func calculate_pass():
x_pass = (SIZE.x - OFFSET.x) / (x_chors.size() - 1 if x_chors.size() > 1 else x_chors.size()) if x_chors.size() > 0:
y_pass = (origin.y - ChartName.get_rect().size.y * 2) / (y_chors.size() - 1 if y_chors.size() > 1 else y_chors.size()) x_pass = (SIZE.x - OFFSET.x) / (x_chors.size() - 1 if x_chors.size() > 1 else x_chors.size())
if y_chors.size() > 0:
y_pass = (origin.y - ChartName.get_rect().size.y * 2) / (y_chors.size() - 1 if y_chors.size() > 1 else y_chors.size())
# Calculate all Points' coordinates in the dataset # Calculate all Points' coordinates in the dataset