-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathTest14a.hs
More file actions
47 lines (38 loc) · 1.38 KB
/
Test14a.hs
File metadata and controls
47 lines (38 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
module Test14a where
import Graphics.Rendering.Chart
import Graphics.Rendering.Chart.Plot
import Data.Colour
import Data.Colour.Names
import Control.Lens
import Data.Default.Class
import Data.Time.LocalTime
import System.Random
import Prices(prices1)
import Utils
-- demonstrate AreaSpots4D
chart :: Double -> Renderable (LayoutPick LocalTime Double Double)
chart lwidth = layoutToRenderable layout
where
layout = layout_title .~"Price History"
$ layout_background .~ solidFillStyle (opaque white)
$ layout_left_axis_visibility . axis_show_ticks .~ False
$ layout_plots .~ [ toPlot price1, toPlot spots ]
$ layout_foreground .~ opaque black
$ def
price1 = plot_lines_style .~ lineStyle
$ plot_lines_values .~ [[ (d, v) | (d,v,_) <- prices1]]
$ plot_lines_title .~ "price 1"
$ def
spots = area_spots_4d_title .~ "random value"
$ area_spots_4d_max_radius .~ 20
$ area_spots_4d_values .~ values
$ def
points = map (\ (d,v,z,t)-> (d,v) ) values
values = [ (d, v, z, t) | ((d,v,_),z,t) <- zip3 prices1 zs ts ]
zs,ts :: [Int]
zs = randoms $ mkStdGen 0
ts = randomRs (-2,27) $ mkStdGen 1
lineStyle = line_width .~ 3 * lwidth
$ line_color .~ opaque blue
$ def ^. plot_lines_style
-- main = main' "test14" (chart 0.25)