Hi all
I’m going to be looking at using Dash to represent a Dict I build from a stream of realtime data. Here’s an example.
data_flow =
Dict{String, Any}("AMZN" => Dict{String, Any}("hv10" => "45.99", "price" => "122.16", "iv_%" => "83.4", "hv20" => "52.14", "iv" => "40.64", "hv5" => "41.21", "prc_%" => "7.51"), "VZ" => Dict{String, Any}("hv10" => "13.87", "price" => "51.27", "iv_%" => "65.61", "hv20" => "12.71", "iv" => "17.62", "hv5" => "10.32", "prc_%" => "19.37"), "C" => Dict{String, Any}("hv10" => "21.26", "price" => "51.78", "iv_%" => "72.73", "hv20" => "42.75", "iv" => "31.75", "hv5" => "20.79", "prc_%" => "11.86"), "IEX" => Dict{String, Any}("hv10" => "19.16", "price" => "195.55", "iv_%" => "70.36", "hv20" => "24.97", "iv" => "27.62", "hv5" => "18.77"))
I’m wondering what the julia approach is to setting up the dash.DataTable. I got the approach for a dataframe which looks straightforward to my noob eyes but what is the approach when the data is already in a Dict and updated real time.
from setting up data datatable using df
app.layout = html_div([
dash_datatable(
id="datatable-interactivity",
columns=[
Dict("name" => i, "id" => i, "deletable" => true, "selectable" => true) for i in keys(data_flow)
],
data=Dict.(pairs.(eachrow(df))),
so I’d just put in the line
columns=[
Dict("name" => i, "id" => i, "deletable" => true, "selectable" => true) for i in Keys = keys(data_flow) ],
Values = values( data_flow)
data = Dict.(pairs.(Values) )