SHARE
TWEET

Untitled

a guest Jul 18th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using Blink
  2. using CSV
  3. using DataFrames
  4. using Interact
  5. using Plots
  6.  
  7. # specify backend
  8. plotlyjs()
  9.  
  10. function main()
  11.     df1 = DataFrame(Any[10*randn(500), 10*rand(500), 10*rand(500)], [:AAA, :BBB, :CCC])
  12.     @show names(df1)
  13.     CSV.write("sample.csv", df1)
  14.     loadbutton = filepicker()
  15.     columnbuttons = Observable{Any}(dom"div"())
  16.     data = Observable{Any}(DataFrame)
  17.     plt = Observable{Any}(plot())
  18.     map!(CSV.read, data, loadbutton)
  19.  
  20.     function makebuttons(df)
  21.         buttons = button.(string.(names(df)))
  22.         for (btn, name) in zip(buttons, names(df))
  23.             map!(t -> histogram(df[name]), plt, btn)
  24.         end
  25.         dom"div"(hbox(buttons))
  26.     end
  27.  
  28.     map!(makebuttons, columnbuttons, data)
  29.  
  30.     ui = dom"div"(loadbutton, columnbuttons, plt)
  31.  
  32.     w = Window()
  33.     body!(w, ui)
  34. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top