import Graphics.Rendering.Chart.Easy
import Graphics.Rendering.Chart.Backend.Cairo
import Data.Time.LocalTime
import Control.Lens
import Data.Colour
import Data.Colour.Names
renderCfg :: FileOptions
renderCfg = FileOptions (2100, 1600) PNG
renderCfg' :: Int -> Int -> FileOptions
renderCfg' a b = FileOptions (a, b) PNG
spots :: [(Double, Int, Double, Double)] -> AreaSpots4D Double Double Double Int
spots v = area_spots_4d_title .~ "random value"
$ area_spots_4d_max_radius .~ 20
$ area_spots_4d_values .~ v
$ area_spots_4d_palette .~ [red, blue]
$ def
chart' :: Renderable ()
chart' = toRenderable $
(layout_plots .~ [toPlot (spots v)]) (def )
where v =
[ (0,0,0,0)
]
Just trying to get a simple chart based on https://github.com/timbod7/haskell-chart/wiki/example-8 however getting a Exception: Prelude.!!: negative index error unfortunately...
Definitely related to the v = [ (0,0,0,0)] as when I instead set it to [] no error occurs...
I'm just not sure why this exception is being triggered.
Hacking the source code of the library:
- let colour = _area_spots_4d_palette p !! t
+
+ let colour = case _area_spots_4d_palette p !!? t of
+ Nothing -> do
+ error $ show t ++ "out of" ++ (show $ _area_spots_4d_palette p)
+ Just colour' -> colour'
Which then errors with:
*** Exception: -9223372036854775808out of[Data.Colour.SRGB.Linear.rgb 1.0 0.0 0.0,Data.Colour.SRGB.Linear.rgb 0.0 0.0 1.0]
No idea where -9223372036854775808 is coming from... ?
Just trying to get a simple chart based on https://github.com/timbod7/haskell-chart/wiki/example-8 however getting a
Exception: Prelude.!!: negative indexerror unfortunately...Definitely related to the
v = [ (0,0,0,0)]as when I instead set it to[]no error occurs...I'm just not sure why this exception is being triggered.
Hacking the source code of the library:
Which then errors with:
No idea where
-9223372036854775808is coming from... ?