elm-highchart/Test.elm

23 lines
651 B
Elm
Raw Permalink Normal View History

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