module Simulation.Aivika.Experiment.Chart.Backend.Cairo
(CairoRenderer(..)) where
import Data.Colour
import Data.Colour.Names
import Control.Lens
import Graphics.Rendering.Chart
import Graphics.Rendering.Chart.Backend.Cairo
import Simulation.Aivika.Experiment
import Simulation.Aivika.Experiment.Chart
data CairoRenderer = CairoRenderer FileFormat
instance ChartRendering CairoRenderer where
renderableChartExtension (CairoRenderer PNG) = ".png"
renderableChartExtension (CairoRenderer SVG) = ".svg"
renderableChartExtension (CairoRenderer PS) = ".ps"
renderableChartExtension (CairoRenderer PDF) = ".pdf"
renderChart (CairoRenderer format) size =
renderableToFile (FileOptions size format)
renderingLayout (CairoRenderer _) = defaultLayout
renderingLayoutLR (CairoRenderer _) = defaultLayoutLR
defaultFontStyle :: FontStyle
defaultFontStyle =
FontStyle "serif" 13 FontSlantNormal FontWeightNormal (opaque black)
defaultTitleFontStyle :: FontStyle
defaultTitleFontStyle =
FontStyle "serif" 18 FontSlantNormal FontWeightBold (opaque black)
defaultLayoutLR :: LayoutLR Double Double Double -> LayoutLR Double Double Double
defaultLayoutLR layoutlr =
layoutlr_title_style .~ defaultTitleFontStyle $
layoutlr_all_font_styles .~ defaultFontStyle $
layoutlr
defaultLayout :: Layout Double Double -> Layout Double Double
defaultLayout layout =
layout_title_style .~ defaultTitleFontStyle $
layout_all_font_styles .~ defaultFontStyle $
layout