elm-highchart/Test.elm
Yann Esposito (Yogsototh) 6d07db291e reactive to mouse pos
2014-12-22 12:26:05 +01:00

22 lines
651 B
Elm

import Graphics.Element (Element,container, middle,widthOf,heightOf)
import Signal
import Mouse
import Window
import Time (fps,timestamp,Time)
import Html (..)
import Html.Attributes (..)
htmlToElement w h el = container w h middle (toElement w h el)
main : Signal Element
main = Signal.map2 view Window.dimensions
(Signal.foldp (+) 0 (fps 10))
view dim t = htmlToElement ((fst dim) - 50) ((snd dim) - 50) <|
div [class "chart"] [text ("Loading... " ++ toString t)]
port xpos : Signal Int
port xpos = Signal.map fst Mouse.position
port point : Signal (Time,(Int,Int))
port point = timestamp Mouse.position