------------------------------------------------------------------------------- |-- Module : Graphics.Rendering.Chart.Plot.Types-- Copyright : (c) Tim Docker 2006-- License : BSD-style (see chart/COPYRIGHT)---- Datatypes and functions common to the implementation of the various-- plot types.--{-# OPTIONS_GHC -XTemplateHaskell #-}moduleGraphics.Rendering.Chart.Plot.Types(Plot(..),joinPlot,ToPlot(..),mapXY,plot_render,plot_legend,plot_all_points,)whereimportqualifiedGraphics.Rendering.CairoasCimportGraphics.Rendering.Chart.TypesimportGraphics.Rendering.Chart.RenderableimportControl.MonadimportData.Accessor.TemplateimportData.ColourimportData.Colour.Names-- | Interface to control plotting on a 2D area.dataPlotxy=Plot{-- | Given the mapping between model space coordinates and device-- coordinates, render this plot into a chart.plot_render_::PointMapFnxy->CRender(),-- | Details for how to show this plot in a legend. For each item-- the string is the text to show, and the function renders a-- graphical sample of the plot.plot_legend_::[(String,Rect->CRender())],-- | All of the model space coordinates to be plotted. These are-- used to autoscale the axes where necessary.plot_all_points_::([x],[y])}-- | A type class abstracting the conversion of a value to a Plot.classToPlotawheretoPlot::axy->Plotxy-- | Join any two plots together (they will share a legend).joinPlot::Plotxy->Plotxy->PlotxyjoinPlotPlot{plot_render_=renderP,plot_legend_=legendP,plot_all_points_=(xsP,ysP)}Plot{plot_render_=renderQ,plot_legend_=legendQ,plot_all_points_=(xsQ,ysQ)}=Plot{plot_render_=\a->renderPa>>renderQa,plot_legend_=legendP++legendQ,plot_all_points_=(xsP++xsQ,ysP++ysQ)}----------------------------------------------------------------------mapXY::PointMapFnxy->((x,y)->Point)mapXYf(x,y)=f(LValuex,LValuey)-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Template haskell to derive an instance of Data.Accessor.Accessor-- for each field.$(deriveAccessors''Plot)