Genie Discord forum
I am new to Genie and have worked through the CSVAnalysis tutorial (https://learn.geniecloud.io/tutorials/written/csv-uploader). Currently, the app updates the histogram only if the chosen column is in the chosen data set.
if selected_column in columns irisplot = PlotData(x=data[!, selected_column], plot=StipplePlotly.Charts.PLOT_TYPE_HISTOGRAM) end
Is it possible to instead change the value of
selected_column to, say, the first entry in
columns whenever the data set changes?
Yes, you would have to add a new handler for selected_file that does something like this
@onchange selected_file selected_column = names(data) end
Note that this would also trigger the previous handler and update the plot
Thanks a lot for your help! 🙂
A short addition if someone else digs up this thread in the future:
@onchange seems to introduce a local scope, and the tutorial defined
data for the first time inside the other handler. With this architecture, setting up a new handler results in the second handler not finding
I solved this by initialising
data outside the
@handlers block, like
@out data = DataFrame().
Please correct me if this is not a good solution!