module Web.Lightning.Plots.Volume
(
VolumePlot(..)
, Visualization (..)
, volumePlot
)
where
import Data.Aeson
import Data.Default.Class
import qualified Data.Text as T
import qualified Web.Lightning.Routes as R
import Web.Lightning.Types.Lightning
import Web.Lightning.Types (Img)
import Web.Lightning.Types.Visualization (Visualization (..))
data VolumePlot = VolumePlot { vpImages :: [Img]
}
deriving (Show, Eq)
instance Default VolumePlot where
def = VolumePlot [ [[[]]] ]
instance ToJSON VolumePlot where
toJSON (VolumePlot imgs) =
object [ "images" .= imgs ]
instance ValidatablePlot VolumePlot where
validatePlot = return
volumePlot :: Monad m => T.Text
-> VolumePlot
-> LightningT m Visualization
volumePlot bUrl volumePlt = do
viz <- sendPlot "volume" volumePlt R.plot
return $ viz { vizBaseUrl = Just bUrl }