Chart 0.14 → 0.15
raw patch · 23 files changed
+341/−460 lines, 23 filesdep −gtkPVP ok
version bump matches the API change (PVP)
Dependencies removed: gtk
API changes (from Hackage documentation)
- Graphics.Rendering.Chart.Gtk: createRenderableWindow :: Renderable a -> Int -> Int -> IO Window
- Graphics.Rendering.Chart.Gtk: renderableToWindow :: Renderable a -> Int -> Int -> IO ()
- Graphics.Rendering.Chart.Gtk: updateCanvas :: Renderable a -> DrawingArea -> IO Bool
- Graphics.Rendering.Chart.Layout: L1P_AxisTitle :: String -> Layout1Pick x y
- Graphics.Rendering.Chart.Simple: instance (IsPlot p, IsPlot q) => IsPlot (p, q)
- Graphics.Rendering.Chart.Simple: instance (IsPlot p, IsPlot q, IsPlot r) => IsPlot (p, q, r)
- Graphics.Rendering.Chart.Simple: instance (PlotArg a, PlotPDFType r) => PlotPDFType (a -> r)
- Graphics.Rendering.Chart.Simple: instance (PlotArg a, PlotPNGType r) => PlotPNGType (a -> r)
- Graphics.Rendering.Chart.Simple: instance (PlotArg a, PlotPSType r) => PlotPSType (a -> r)
- Graphics.Rendering.Chart.Simple: instance (PlotArg a, PlotType r) => PlotType (a -> r)
- Graphics.Rendering.Chart.Simple: instance (PlotArg a, PlotWindowType r) => PlotWindowType (a -> r)
- Graphics.Rendering.Chart.Simple: instance (Real a, Real b, Fractional a, Fractional b) => IsPlot (a -> b)
- Graphics.Rendering.Chart.Simple: instance (Real a, Real b, Fractional a, Fractional b) => PlotArg (a -> b)
- Graphics.Rendering.Chart.Simple: instance Eq PlotKind
- Graphics.Rendering.Chart.Simple: instance IsPlot Char
- Graphics.Rendering.Chart.Simple: instance IsPlot Double
- Graphics.Rendering.Chart.Simple: instance IsPlot PlotKind
- Graphics.Rendering.Chart.Simple: instance IsPlot p => IsPlot [p]
- Graphics.Rendering.Chart.Simple: instance IsPlot p => PlotArg [p]
- Graphics.Rendering.Chart.Simple: instance Ord PlotKind
- Graphics.Rendering.Chart.Simple: instance PlotArg PlotKind
- Graphics.Rendering.Chart.Simple: instance PlotArg UPlot
- Graphics.Rendering.Chart.Simple: instance PlotPDFType (IO a)
- Graphics.Rendering.Chart.Simple: instance PlotPNGType (IO a)
- Graphics.Rendering.Chart.Simple: instance PlotPSType (IO a)
- Graphics.Rendering.Chart.Simple: instance PlotType Layout1DDD
- Graphics.Rendering.Chart.Simple: instance PlotWindowType (IO a)
- Graphics.Rendering.Chart.Simple: instance Show PlotKind
- Graphics.Rendering.Chart.Simple: instance ToRenderable Layout1DDD
- Graphics.Rendering.Chart.Simple: plotWindow :: PlotWindowType a => a
+ Graphics.Rendering.Chart.Axis.Types: axisGridAtBigTicks :: AxisData x -> AxisData x
+ Graphics.Rendering.Chart.Axis.Types: axisLabelsOverride :: [(x, String)] -> AxisData x -> AxisData x
+ Graphics.Rendering.Chart.Layout: L1P_BottomAxisTitle :: String -> Layout1Pick x y
+ Graphics.Rendering.Chart.Layout: L1P_LeftAxisTitle :: String -> Layout1Pick x y
+ Graphics.Rendering.Chart.Layout: L1P_RightAxisTitle :: String -> Layout1Pick x y
+ Graphics.Rendering.Chart.Layout: L1P_TopAxisTitle :: String -> Layout1Pick x y
+ Graphics.Rendering.Chart.Renderable: mapMaybePickFn :: (a -> Maybe b) -> Renderable a -> Renderable b
+ Graphics.Rendering.Chart.Simple.Internal: Dashed :: PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: Diamond :: PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: Dotted :: PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: DownTriangle :: PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: Ex :: PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: FilledCircle :: PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: HollowCircle :: PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: IPX :: [x] -> [PlotKind] -> InternalPlot x y
+ Graphics.Rendering.Chart.Simple.Internal: IPY :: [y] -> [PlotKind] -> InternalPlot x y
+ Graphics.Rendering.Chart.Simple.Internal: Layout1DDD :: Layout1 Double Double -> Layout1DDD
+ Graphics.Rendering.Chart.Simple.Internal: LittleDot :: PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: Name :: String -> PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: Plus :: PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: Solid :: PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: Square :: PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: Star :: PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: Symbols :: PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: Triangle :: PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: UDoubles :: [Double] -> UPlot
+ Graphics.Rendering.Chart.Simple.Internal: UFunction :: (Double -> Double) -> UPlot
+ Graphics.Rendering.Chart.Simple.Internal: UKind :: [PlotKind] -> UPlot
+ Graphics.Rendering.Chart.Simple.Internal: UString :: String -> UPlot
+ Graphics.Rendering.Chart.Simple.Internal: X :: [Double] -> UPlot
+ Graphics.Rendering.Chart.Simple.Internal: class IsPlot c
+ Graphics.Rendering.Chart.Simple.Internal: class PlotArg a
+ Graphics.Rendering.Chart.Simple.Internal: class PlotPDFType t
+ Graphics.Rendering.Chart.Simple.Internal: class PlotPNGType t
+ Graphics.Rendering.Chart.Simple.Internal: class PlotPSType t
+ Graphics.Rendering.Chart.Simple.Internal: class PlotType t
+ Graphics.Rendering.Chart.Simple.Internal: data InternalPlot x y
+ Graphics.Rendering.Chart.Simple.Internal: data PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: data UPlot
+ Graphics.Rendering.Chart.Simple.Internal: instance (IsPlot p, IsPlot q) => IsPlot (p, q)
+ Graphics.Rendering.Chart.Simple.Internal: instance (IsPlot p, IsPlot q, IsPlot r) => IsPlot (p, q, r)
+ Graphics.Rendering.Chart.Simple.Internal: instance (PlotArg a, PlotPDFType r) => PlotPDFType (a -> r)
+ Graphics.Rendering.Chart.Simple.Internal: instance (PlotArg a, PlotPNGType r) => PlotPNGType (a -> r)
+ Graphics.Rendering.Chart.Simple.Internal: instance (PlotArg a, PlotPSType r) => PlotPSType (a -> r)
+ Graphics.Rendering.Chart.Simple.Internal: instance (PlotArg a, PlotType r) => PlotType (a -> r)
+ Graphics.Rendering.Chart.Simple.Internal: instance (Real a, Real b, Fractional a, Fractional b) => IsPlot (a -> b)
+ Graphics.Rendering.Chart.Simple.Internal: instance (Real a, Real b, Fractional a, Fractional b) => PlotArg (a -> b)
+ Graphics.Rendering.Chart.Simple.Internal: instance Eq PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: instance IsPlot Char
+ Graphics.Rendering.Chart.Simple.Internal: instance IsPlot Double
+ Graphics.Rendering.Chart.Simple.Internal: instance IsPlot PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: instance IsPlot p => IsPlot [p]
+ Graphics.Rendering.Chart.Simple.Internal: instance IsPlot p => PlotArg [p]
+ Graphics.Rendering.Chart.Simple.Internal: instance Ord PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: instance PlotArg PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: instance PlotArg UPlot
+ Graphics.Rendering.Chart.Simple.Internal: instance PlotPDFType (IO a)
+ Graphics.Rendering.Chart.Simple.Internal: instance PlotPNGType (IO a)
+ Graphics.Rendering.Chart.Simple.Internal: instance PlotPSType (IO a)
+ Graphics.Rendering.Chart.Simple.Internal: instance PlotType Layout1DDD
+ Graphics.Rendering.Chart.Simple.Internal: instance Show PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: instance ToRenderable Layout1DDD
+ Graphics.Rendering.Chart.Simple.Internal: iplot :: [InternalPlot Double Double] -> Layout1 Double Double
+ Graphics.Rendering.Chart.Simple.Internal: name :: [PlotKind] -> String
+ Graphics.Rendering.Chart.Simple.Internal: newtype Layout1DDD
+ Graphics.Rendering.Chart.Simple.Internal: pl :: PlotType t => [UPlot] -> t
+ Graphics.Rendering.Chart.Simple.Internal: pld :: PlotPDFType t => FilePath -> [UPlot] -> t
+ Graphics.Rendering.Chart.Simple.Internal: plot :: PlotType a => a
+ Graphics.Rendering.Chart.Simple.Internal: plotLayout :: Layout1DDD -> Layout1 Double Double
+ Graphics.Rendering.Chart.Simple.Internal: plotPDF :: PlotPDFType a => String -> a
+ Graphics.Rendering.Chart.Simple.Internal: plotPNG :: PlotPNGType a => String -> a
+ Graphics.Rendering.Chart.Simple.Internal: plotPS :: PlotPSType a => String -> a
+ Graphics.Rendering.Chart.Simple.Internal: plp :: PlotPNGType t => FilePath -> [UPlot] -> t
+ Graphics.Rendering.Chart.Simple.Internal: pls :: PlotPSType t => FilePath -> [UPlot] -> t
+ Graphics.Rendering.Chart.Simple.Internal: str2k :: String -> [PlotKind]
+ Graphics.Rendering.Chart.Simple.Internal: str2khelper :: String -> PlotKind -> [PlotKind]
+ Graphics.Rendering.Chart.Simple.Internal: styleColor :: Int -> AlphaColour Double
+ Graphics.Rendering.Chart.Simple.Internal: styleSymbol :: Int -> PlotKind
+ Graphics.Rendering.Chart.Simple.Internal: toUPlot :: PlotArg a => a -> [UPlot]
+ Graphics.Rendering.Chart.Simple.Internal: toUPlot' :: IsPlot c => [c] -> [UPlot]
+ Graphics.Rendering.Chart.Simple.Internal: uplot :: [UPlot] -> Layout1DDD
+ Graphics.Rendering.Chart.Simple.Internal: xcoords :: [Double] -> UPlot
- Graphics.Rendering.Chart.Axis.Floating: defaultLinearAxis :: Show a => LinearAxisParams a
+ Graphics.Rendering.Chart.Axis.Floating: defaultLinearAxis :: (Show a, RealFloat a) => LinearAxisParams a
- Graphics.Rendering.Chart.Axis.Floating: defaultLogAxis :: Show a => LogAxisParams a
+ Graphics.Rendering.Chart.Axis.Floating: defaultLogAxis :: (Show a, RealFloat a) => LogAxisParams a
- Graphics.Rendering.Chart.Axis.Floating: la_labelf :: T (LinearAxisParams a_alvh) (a_alvh -> String)
+ Graphics.Rendering.Chart.Axis.Floating: la_labelf :: T (LinearAxisParams a_ajni) (a_ajni -> String)
- Graphics.Rendering.Chart.Axis.Floating: la_nLabels :: T (LinearAxisParams a_alvh) Int
+ Graphics.Rendering.Chart.Axis.Floating: la_nLabels :: T (LinearAxisParams a_ajni) Int
- Graphics.Rendering.Chart.Axis.Floating: la_nTicks :: T (LinearAxisParams a_alvh) Int
+ Graphics.Rendering.Chart.Axis.Floating: la_nTicks :: T (LinearAxisParams a_ajni) Int
- Graphics.Rendering.Chart.Axis.Floating: loga_labelf :: T (LogAxisParams a_alvg) (a_alvg -> String)
+ Graphics.Rendering.Chart.Axis.Floating: loga_labelf :: T (LogAxisParams a_ajnh) (a_ajnh -> String)
- Graphics.Rendering.Chart.Axis.Types: axis_grid :: T (AxisData x_ahhb) [x_ahhb]
+ Graphics.Rendering.Chart.Axis.Types: axis_grid :: T (AxisData x_adV6) [x_adV6]
- Graphics.Rendering.Chart.Axis.Types: axis_labels :: T (AxisData x_ahhb) [[(x_ahhb, String)]]
+ Graphics.Rendering.Chart.Axis.Types: axis_labels :: T (AxisData x_adV6) [[(x_adV6, String)]]
- Graphics.Rendering.Chart.Axis.Types: axis_ticks :: T (AxisData x_ahhb) [(x_ahhb, Double)]
+ Graphics.Rendering.Chart.Axis.Types: axis_ticks :: T (AxisData x_adV6) [(x_adV6, Double)]
- Graphics.Rendering.Chart.Axis.Types: axis_tropweiv :: T (AxisData x_ahhb) (Range -> Double -> x_ahhb)
+ Graphics.Rendering.Chart.Axis.Types: axis_tropweiv :: T (AxisData x_adV6) (Range -> Double -> x_adV6)
- Graphics.Rendering.Chart.Axis.Types: axis_viewport :: T (AxisData x_ahhb) (Range -> x_ahhb -> Double)
+ Graphics.Rendering.Chart.Axis.Types: axis_viewport :: T (AxisData x_adV6) (Range -> x_adV6 -> Double)
- Graphics.Rendering.Chart.Layout: laxis_generate :: T (LayoutAxis x_a10A4) (AxisFn x_a10A4)
+ Graphics.Rendering.Chart.Layout: laxis_generate :: T (LayoutAxis x_aW9v) (AxisFn x_aW9v)
- Graphics.Rendering.Chart.Layout: laxis_override :: T (LayoutAxis x_a10A4) (AxisData x_a10A4 -> AxisData x_a10A4)
+ Graphics.Rendering.Chart.Layout: laxis_override :: T (LayoutAxis x_aW9v) (AxisData x_aW9v -> AxisData x_aW9v)
- Graphics.Rendering.Chart.Layout: laxis_reverse :: T (LayoutAxis x_a10A4) Bool
+ Graphics.Rendering.Chart.Layout: laxis_reverse :: T (LayoutAxis x_aW9v) Bool
- Graphics.Rendering.Chart.Layout: laxis_style :: T (LayoutAxis x_a10A4) AxisStyle
+ Graphics.Rendering.Chart.Layout: laxis_style :: T (LayoutAxis x_aW9v) AxisStyle
- Graphics.Rendering.Chart.Layout: laxis_title :: T (LayoutAxis x_a10A4) String
+ Graphics.Rendering.Chart.Layout: laxis_title :: T (LayoutAxis x_aW9v) String
- Graphics.Rendering.Chart.Layout: laxis_title_style :: T (LayoutAxis x_a10A4) CairoFontStyle
+ Graphics.Rendering.Chart.Layout: laxis_title_style :: T (LayoutAxis x_aW9v) CairoFontStyle
- Graphics.Rendering.Chart.Layout: laxis_visible :: T (LayoutAxis x_a10A4) ([x_a10A4] -> Bool)
+ Graphics.Rendering.Chart.Layout: laxis_visible :: T (LayoutAxis x_aW9v) ([x_aW9v] -> Bool)
- Graphics.Rendering.Chart.Layout: layout1_background :: T (Layout1 x_a10A2 y_a10A3) CairoFillStyle
+ Graphics.Rendering.Chart.Layout: layout1_background :: T (Layout1 x_aW9t y_aW9u) CairoFillStyle
- Graphics.Rendering.Chart.Layout: layout1_bottom_axis :: T (Layout1 x_a10A2 y_a10A3) (LayoutAxis x_a10A2)
+ Graphics.Rendering.Chart.Layout: layout1_bottom_axis :: T (Layout1 x_aW9t y_aW9u) (LayoutAxis x_aW9t)
- Graphics.Rendering.Chart.Layout: layout1_grid_last :: T (Layout1 x_a10A2 y_a10A3) Bool
+ Graphics.Rendering.Chart.Layout: layout1_grid_last :: T (Layout1 x_aW9t y_aW9u) Bool
- Graphics.Rendering.Chart.Layout: layout1_left_axis :: T (Layout1 x_a10A2 y_a10A3) (LayoutAxis y_a10A3)
+ Graphics.Rendering.Chart.Layout: layout1_left_axis :: T (Layout1 x_aW9t y_aW9u) (LayoutAxis y_aW9u)
- Graphics.Rendering.Chart.Layout: layout1_legend :: T (Layout1 x_a10A2 y_a10A3) (Maybe LegendStyle)
+ Graphics.Rendering.Chart.Layout: layout1_legend :: T (Layout1 x_aW9t y_aW9u) (Maybe LegendStyle)
- Graphics.Rendering.Chart.Layout: layout1_margin :: T (Layout1 x_a10A2 y_a10A3) Double
+ Graphics.Rendering.Chart.Layout: layout1_margin :: T (Layout1 x_aW9t y_aW9u) Double
- Graphics.Rendering.Chart.Layout: layout1_plot_background :: T (Layout1 x_a10A2 y_a10A3) (Maybe CairoFillStyle)
+ Graphics.Rendering.Chart.Layout: layout1_plot_background :: T (Layout1 x_aW9t y_aW9u) (Maybe CairoFillStyle)
- Graphics.Rendering.Chart.Layout: layout1_plots :: T (Layout1 x_a10A2 y_a10A3) [Either (Plot x_a10A2 y_a10A3) (Plot x_a10A2 y_a10A3)]
+ Graphics.Rendering.Chart.Layout: layout1_plots :: T (Layout1 x_aW9t y_aW9u) [Either (Plot x_aW9t y_aW9u) (Plot x_aW9t y_aW9u)]
- Graphics.Rendering.Chart.Layout: layout1_right_axis :: T (Layout1 x_a10A2 y_a10A3) (LayoutAxis y_a10A3)
+ Graphics.Rendering.Chart.Layout: layout1_right_axis :: T (Layout1 x_aW9t y_aW9u) (LayoutAxis y_aW9u)
- Graphics.Rendering.Chart.Layout: layout1_title :: T (Layout1 x_a10A2 y_a10A3) String
+ Graphics.Rendering.Chart.Layout: layout1_title :: T (Layout1 x_aW9t y_aW9u) String
- Graphics.Rendering.Chart.Layout: layout1_title_style :: T (Layout1 x_a10A2 y_a10A3) CairoFontStyle
+ Graphics.Rendering.Chart.Layout: layout1_title_style :: T (Layout1 x_aW9t y_aW9u) CairoFontStyle
- Graphics.Rendering.Chart.Layout: layout1_top_axis :: T (Layout1 x_a10A2 y_a10A3) (LayoutAxis x_a10A2)
+ Graphics.Rendering.Chart.Layout: layout1_top_axis :: T (Layout1 x_aW9t y_aW9u) (LayoutAxis x_aW9t)
- Graphics.Rendering.Chart.Layout: layout1_yaxes_control :: T (Layout1 x_a10A2 y_a10A3) (([y_a10A3], [y_a10A3]) -> ([y_a10A3], [y_a10A3]))
+ Graphics.Rendering.Chart.Layout: layout1_yaxes_control :: T (Layout1 x_aW9t y_aW9u) (([y_aW9u], [y_aW9u]) -> ([y_aW9u], [y_aW9u]))
- Graphics.Rendering.Chart.Plot.Annotation: plot_annotation_angle :: T (PlotAnnotation x_aY7h y_aY7i) Double
+ Graphics.Rendering.Chart.Plot.Annotation: plot_annotation_angle :: T (PlotAnnotation x_aR3b y_aR3c) Double
- Graphics.Rendering.Chart.Plot.Annotation: plot_annotation_hanchor :: T (PlotAnnotation x_aY7h y_aY7i) HTextAnchor
+ Graphics.Rendering.Chart.Plot.Annotation: plot_annotation_hanchor :: T (PlotAnnotation x_aR3b y_aR3c) HTextAnchor
- Graphics.Rendering.Chart.Plot.Annotation: plot_annotation_style :: T (PlotAnnotation x_aY7h y_aY7i) CairoFontStyle
+ Graphics.Rendering.Chart.Plot.Annotation: plot_annotation_style :: T (PlotAnnotation x_aR3b y_aR3c) CairoFontStyle
- Graphics.Rendering.Chart.Plot.Annotation: plot_annotation_values :: T (PlotAnnotation x_aY7h y_aY7i) [(x_aY7h, y_aY7i, String)]
+ Graphics.Rendering.Chart.Plot.Annotation: plot_annotation_values :: T (PlotAnnotation x_aR3b y_aR3c) [(x_aR3b, y_aR3c, String)]
- Graphics.Rendering.Chart.Plot.Annotation: plot_annotation_vanchor :: T (PlotAnnotation x_aY7h y_aY7i) VTextAnchor
+ Graphics.Rendering.Chart.Plot.Annotation: plot_annotation_vanchor :: T (PlotAnnotation x_aR3b y_aR3c) VTextAnchor
- Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_4d_linethick :: T (AreaSpots4D z_aMXj t_aMXk x_aMXl y_aMXm) Double
+ Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_4d_linethick :: T (AreaSpots4D z_aRuA t_aRuB x_aRuC y_aRuD) Double
- Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_4d_max_radius :: T (AreaSpots4D z_aMXj t_aMXk x_aMXl y_aMXm) Double
+ Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_4d_max_radius :: T (AreaSpots4D z_aRuA t_aRuB x_aRuC y_aRuD) Double
- Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_4d_palette :: T (AreaSpots4D z_aMXj t_aMXk x_aMXl y_aMXm) [Colour Double]
+ Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_4d_palette :: T (AreaSpots4D z_aRuA t_aRuB x_aRuC y_aRuD) [Colour Double]
- Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_4d_title :: T (AreaSpots4D z_aMXj t_aMXk x_aMXl y_aMXm) String
+ Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_4d_title :: T (AreaSpots4D z_aRuA t_aRuB x_aRuC y_aRuD) String
- Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_4d_values :: T (AreaSpots4D z_aMXj t_aMXk x_aMXl y_aMXm) [(x_aMXl, y_aMXm, z_aMXj, t_aMXk)]
+ Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_4d_values :: T (AreaSpots4D z_aRuA t_aRuB x_aRuC y_aRuD) [(x_aRuC, y_aRuD, z_aRuA, t_aRuB)]
- Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_fillcolour :: T (AreaSpots z_aMXn x_aMXo y_aMXp) (AlphaColour Double)
+ Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_fillcolour :: T (AreaSpots z_aRuE x_aRuF y_aRuG) (AlphaColour Double)
- Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_linecolour :: T (AreaSpots z_aMXn x_aMXo y_aMXp) (AlphaColour Double)
+ Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_linecolour :: T (AreaSpots z_aRuE x_aRuF y_aRuG) (AlphaColour Double)
- Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_linethick :: T (AreaSpots z_aMXn x_aMXo y_aMXp) Double
+ Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_linethick :: T (AreaSpots z_aRuE x_aRuF y_aRuG) Double
- Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_max_radius :: T (AreaSpots z_aMXn x_aMXo y_aMXp) Double
+ Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_max_radius :: T (AreaSpots z_aRuE x_aRuF y_aRuG) Double
- Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_title :: T (AreaSpots z_aMXn x_aMXo y_aMXp) String
+ Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_title :: T (AreaSpots z_aRuE x_aRuF y_aRuG) String
- Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_values :: T (AreaSpots z_aMXn x_aMXo y_aMXp) [(x_aMXo, y_aMXp, z_aMXn)]
+ Graphics.Rendering.Chart.Plot.AreaSpots: area_spots_values :: T (AreaSpots z_aRuE x_aRuF y_aRuG) [(x_aRuF, y_aRuG, z_aRuE)]
- Graphics.Rendering.Chart.Plot.Bars: plot_bars_alignment :: T (PlotBars x_aVqZ y_aVr0) PlotBarsAlignment
+ Graphics.Rendering.Chart.Plot.Bars: plot_bars_alignment :: T (PlotBars x_aOmM y_aOmN) PlotBarsAlignment
- Graphics.Rendering.Chart.Plot.Bars: plot_bars_item_styles :: T (PlotBars x_aVqZ y_aVr0) [(CairoFillStyle, Maybe CairoLineStyle)]
+ Graphics.Rendering.Chart.Plot.Bars: plot_bars_item_styles :: T (PlotBars x_aOmM y_aOmN) [(CairoFillStyle, Maybe CairoLineStyle)]
- Graphics.Rendering.Chart.Plot.Bars: plot_bars_reference :: T (PlotBars x_aVqZ y_aVr0) y_aVr0
+ Graphics.Rendering.Chart.Plot.Bars: plot_bars_reference :: T (PlotBars x_aOmM y_aOmN) y_aOmN
- Graphics.Rendering.Chart.Plot.Bars: plot_bars_singleton_width :: T (PlotBars x_aVqZ y_aVr0) Double
+ Graphics.Rendering.Chart.Plot.Bars: plot_bars_singleton_width :: T (PlotBars x_aOmM y_aOmN) Double
- Graphics.Rendering.Chart.Plot.Bars: plot_bars_spacing :: T (PlotBars x_aVqZ y_aVr0) PlotBarsSpacing
+ Graphics.Rendering.Chart.Plot.Bars: plot_bars_spacing :: T (PlotBars x_aOmM y_aOmN) PlotBarsSpacing
- Graphics.Rendering.Chart.Plot.Bars: plot_bars_style :: T (PlotBars x_aVqZ y_aVr0) PlotBarsStyle
+ Graphics.Rendering.Chart.Plot.Bars: plot_bars_style :: T (PlotBars x_aOmM y_aOmN) PlotBarsStyle
- Graphics.Rendering.Chart.Plot.Bars: plot_bars_titles :: T (PlotBars x_aVqZ y_aVr0) [String]
+ Graphics.Rendering.Chart.Plot.Bars: plot_bars_titles :: T (PlotBars x_aOmM y_aOmN) [String]
- Graphics.Rendering.Chart.Plot.Bars: plot_bars_values :: T (PlotBars x_aVqZ y_aVr0) [(x_aVqZ, [y_aVr0])]
+ Graphics.Rendering.Chart.Plot.Bars: plot_bars_values :: T (PlotBars x_aOmM y_aOmN) [(x_aOmM, [y_aOmN])]
- Graphics.Rendering.Chart.Plot.Candle: plot_candle_centre :: T (PlotCandle x_aT7A y_aT7B) Double
+ Graphics.Rendering.Chart.Plot.Candle: plot_candle_centre :: T (PlotCandle x_aM3n y_aM3o) Double
- Graphics.Rendering.Chart.Plot.Candle: plot_candle_fall_fill_style :: T (PlotCandle x_aT7A y_aT7B) CairoFillStyle
+ Graphics.Rendering.Chart.Plot.Candle: plot_candle_fall_fill_style :: T (PlotCandle x_aM3n y_aM3o) CairoFillStyle
- Graphics.Rendering.Chart.Plot.Candle: plot_candle_fill :: T (PlotCandle x_aT7A y_aT7B) Bool
+ Graphics.Rendering.Chart.Plot.Candle: plot_candle_fill :: T (PlotCandle x_aM3n y_aM3o) Bool
- Graphics.Rendering.Chart.Plot.Candle: plot_candle_line_style :: T (PlotCandle x_aT7A y_aT7B) CairoLineStyle
+ Graphics.Rendering.Chart.Plot.Candle: plot_candle_line_style :: T (PlotCandle x_aM3n y_aM3o) CairoLineStyle
- Graphics.Rendering.Chart.Plot.Candle: plot_candle_rise_fill_style :: T (PlotCandle x_aT7A y_aT7B) CairoFillStyle
+ Graphics.Rendering.Chart.Plot.Candle: plot_candle_rise_fill_style :: T (PlotCandle x_aM3n y_aM3o) CairoFillStyle
- Graphics.Rendering.Chart.Plot.Candle: plot_candle_tick_length :: T (PlotCandle x_aT7A y_aT7B) Double
+ Graphics.Rendering.Chart.Plot.Candle: plot_candle_tick_length :: T (PlotCandle x_aM3n y_aM3o) Double
- Graphics.Rendering.Chart.Plot.Candle: plot_candle_title :: T (PlotCandle x_aT7A y_aT7B) String
+ Graphics.Rendering.Chart.Plot.Candle: plot_candle_title :: T (PlotCandle x_aM3n y_aM3o) String
- Graphics.Rendering.Chart.Plot.Candle: plot_candle_values :: T (PlotCandle x_aT7A y_aT7B) [Candle x_aT7A y_aT7B]
+ Graphics.Rendering.Chart.Plot.Candle: plot_candle_values :: T (PlotCandle x_aM3n y_aM3o) [Candle x_aM3n y_aM3o]
- Graphics.Rendering.Chart.Plot.Candle: plot_candle_width :: T (PlotCandle x_aT7A y_aT7B) Double
+ Graphics.Rendering.Chart.Plot.Candle: plot_candle_width :: T (PlotCandle x_aM3n y_aM3o) Double
- Graphics.Rendering.Chart.Plot.ErrBars: plot_errbars_line_style :: T (PlotErrBars x_aRk7 y_aRk8) CairoLineStyle
+ Graphics.Rendering.Chart.Plot.ErrBars: plot_errbars_line_style :: T (PlotErrBars x_aKfU y_aKfV) CairoLineStyle
- Graphics.Rendering.Chart.Plot.ErrBars: plot_errbars_overhang :: T (PlotErrBars x_aRk7 y_aRk8) Double
+ Graphics.Rendering.Chart.Plot.ErrBars: plot_errbars_overhang :: T (PlotErrBars x_aKfU y_aKfV) Double
- Graphics.Rendering.Chart.Plot.ErrBars: plot_errbars_tick_length :: T (PlotErrBars x_aRk7 y_aRk8) Double
+ Graphics.Rendering.Chart.Plot.ErrBars: plot_errbars_tick_length :: T (PlotErrBars x_aKfU y_aKfV) Double
- Graphics.Rendering.Chart.Plot.ErrBars: plot_errbars_title :: T (PlotErrBars x_aRk7 y_aRk8) String
+ Graphics.Rendering.Chart.Plot.ErrBars: plot_errbars_title :: T (PlotErrBars x_aKfU y_aKfV) String
- Graphics.Rendering.Chart.Plot.ErrBars: plot_errbars_values :: T (PlotErrBars x_aRk7 y_aRk8) [ErrPoint x_aRk7 y_aRk8]
+ Graphics.Rendering.Chart.Plot.ErrBars: plot_errbars_values :: T (PlotErrBars x_aKfU y_aKfV) [ErrPoint x_aKfU y_aKfV]
- Graphics.Rendering.Chart.Plot.FillBetween: plot_fillbetween_style :: T (PlotFillBetween x_aQL4 y_aQL5) CairoFillStyle
+ Graphics.Rendering.Chart.Plot.FillBetween: plot_fillbetween_style :: T (PlotFillBetween x_aJGR y_aJGS) CairoFillStyle
- Graphics.Rendering.Chart.Plot.FillBetween: plot_fillbetween_title :: T (PlotFillBetween x_aQL4 y_aQL5) String
+ Graphics.Rendering.Chart.Plot.FillBetween: plot_fillbetween_title :: T (PlotFillBetween x_aJGR y_aJGS) String
- Graphics.Rendering.Chart.Plot.FillBetween: plot_fillbetween_values :: T (PlotFillBetween x_aQL4 y_aQL5) [(x_aQL4, (y_aQL5, y_aQL5))]
+ Graphics.Rendering.Chart.Plot.FillBetween: plot_fillbetween_values :: T (PlotFillBetween x_aJGR y_aJGS) [(x_aJGR, (y_aJGS, y_aJGS))]
- Graphics.Rendering.Chart.Plot.Lines: plot_lines_limit_values :: T (PlotLines x_aPAE y_aPAF) [[(Limit x_aPAE, Limit y_aPAF)]]
+ Graphics.Rendering.Chart.Plot.Lines: plot_lines_limit_values :: T (PlotLines x_aIwr y_aIws) [[(Limit x_aIwr, Limit y_aIws)]]
- Graphics.Rendering.Chart.Plot.Lines: plot_lines_style :: T (PlotLines x_aPAE y_aPAF) CairoLineStyle
+ Graphics.Rendering.Chart.Plot.Lines: plot_lines_style :: T (PlotLines x_aIwr y_aIws) CairoLineStyle
- Graphics.Rendering.Chart.Plot.Lines: plot_lines_title :: T (PlotLines x_aPAE y_aPAF) String
+ Graphics.Rendering.Chart.Plot.Lines: plot_lines_title :: T (PlotLines x_aIwr y_aIws) String
- Graphics.Rendering.Chart.Plot.Lines: plot_lines_values :: T (PlotLines x_aPAE y_aPAF) [[(x_aPAE, y_aPAF)]]
+ Graphics.Rendering.Chart.Plot.Lines: plot_lines_values :: T (PlotLines x_aIwr y_aIws) [[(x_aIwr, y_aIws)]]
- Graphics.Rendering.Chart.Plot.Points: plot_points_style :: T (PlotPoints x_aQiQ y_aQiR) CairoPointStyle
+ Graphics.Rendering.Chart.Plot.Points: plot_points_style :: T (PlotPoints x_aJeD y_aJeE) CairoPointStyle
- Graphics.Rendering.Chart.Plot.Points: plot_points_title :: T (PlotPoints x_aQiQ y_aQiR) String
+ Graphics.Rendering.Chart.Plot.Points: plot_points_title :: T (PlotPoints x_aJeD y_aJeE) String
- Graphics.Rendering.Chart.Plot.Points: plot_points_values :: T (PlotPoints x_aQiQ y_aQiR) [(x_aQiQ, y_aQiR)]
+ Graphics.Rendering.Chart.Plot.Points: plot_points_values :: T (PlotPoints x_aJeD y_aJeE) [(x_aJeD, y_aJeE)]
- Graphics.Rendering.Chart.Plot.Types: plot_all_points :: T (Plot x_aLV9 y_aLVa) ([x_aLV9], [y_aLVa])
+ Graphics.Rendering.Chart.Plot.Types: plot_all_points :: T (Plot x_aHux y_aHuy) ([x_aHux], [y_aHuy])
- Graphics.Rendering.Chart.Plot.Types: plot_legend :: T (Plot x_aLV9 y_aLVa) [(String, Rect -> CRender ())]
+ Graphics.Rendering.Chart.Plot.Types: plot_legend :: T (Plot x_aHux y_aHuy) [(String, Rect -> CRender ())]
- Graphics.Rendering.Chart.Plot.Types: plot_render :: T (Plot x_aLV9 y_aLVa) (PointMapFn x_aLV9 y_aLVa -> CRender ())
+ Graphics.Rendering.Chart.Plot.Types: plot_render :: T (Plot x_aHux y_aHuy) (PointMapFn x_aHux y_aHuy -> CRender ())
Files
- Chart.cabal +2/−10
- Graphics/Rendering/Chart/Axis/Floating.hs +8/−5
- Graphics/Rendering/Chart/Axis/Types.hs +22/−7
- Graphics/Rendering/Chart/Gtk.hs +0/−81
- Graphics/Rendering/Chart/Layout.hs +16/−13
- Graphics/Rendering/Chart/Renderable.hs +7/−2
- Graphics/Rendering/Chart/Simple.hs +2/−304
- Graphics/Rendering/Chart/Simple/Internal.hs +277/−0
- tests/Test1.hs +0/−2
- tests/Test14.hs +0/−2
- tests/Test14a.hs +0/−2
- tests/Test15.hs +0/−2
- tests/Test17.hs +2/−4
- tests/Test2.hs +0/−2
- tests/Test3.hs +0/−2
- tests/Test4.hs +0/−2
- tests/Test5.hs +0/−2
- tests/Test6.hs +0/−2
- tests/Test7.hs +0/−2
- tests/Test8.hs +0/−2
- tests/Test9.hs +0/−2
- tests/TestParametric.hs +2/−4
- tests/all_tests.hs +3/−6
Chart.cabal view
@@ -1,5 +1,5 @@ Name: Chart-Version: 0.14+Version: 0.15 License: BSD3 License-file: LICENSE Copyright: Tim Docker, 2006-2010@@ -34,10 +34,6 @@ flag splitbase description: Choose the new smaller, split-up base package. -flag gtk- description: If gtk2hs is available, add extra API functions to use it.- default: True- library if flag(splitbase) Build-depends: base >= 3 && < 5, old-locale, time, mtl, array@@ -46,11 +42,6 @@ Build-depends: cairo >= 0.9.11, time, mtl, array, data-accessor == 0.2.*, data-accessor-template >= 0.2.1.1 && < 0.3, colour >= 2.2.1 - if flag(gtk)- build-depends: gtk >= 0.9.11- exposed-modules: Graphics.Rendering.Chart.Gtk- cpp-options: -DHAVE_GTK=1- Exposed-modules: Graphics.Rendering.Chart, Graphics.Rendering.Chart.Types,@@ -65,6 +56,7 @@ Graphics.Rendering.Chart.Layout, Graphics.Rendering.Chart.Legend, Graphics.Rendering.Chart.Simple,+ Graphics.Rendering.Chart.Simple.Internal, Graphics.Rendering.Chart.Grid, Graphics.Rendering.Chart.Plot, Graphics.Rendering.Chart.Plot.Types,
Graphics/Rendering/Chart/Axis/Floating.hs view
@@ -31,6 +31,7 @@ import Data.List(minimumBy) import Data.Ord (comparing)+import Numeric (showFFloat) import Data.Accessor.Template import Graphics.Rendering.Chart.Types@@ -67,9 +68,10 @@ fromValue d = LogValue (exp d) autoAxis = autoScaledLogAxis defaultLogAxis -showD x = case reverse $ show x of+showD :: (RealFloat d) => d -> String+showD x = case reverse $ showFFloat Nothing x "" of '0':'.':r -> reverse r- _ -> show x+ r -> reverse r data LinearAxisParams a = LinearAxisParams { -- | The function used to show the axes labels.@@ -82,7 +84,7 @@ la_nTicks_ :: Int } -defaultLinearAxis :: (Show a) => LinearAxisParams a+defaultLinearAxis :: (Show a, RealFloat a) => LinearAxisParams a defaultLinearAxis = LinearAxisParams { la_labelf_ = showD, la_nLabels_ = 5,@@ -98,7 +100,8 @@ ps = filter isValidNumber ps0 (min,max) = (minimum ps,maximum ps) range [] = (0,1)- range _ | min == max = (min-1,min+1)+ range _ | min == max = if min==0 then (-1,1) else+ let d = abs (min * 0.01) in (min-d,max+d) | otherwise = (min,max) labelvs = map fromRational $ steps (fromIntegral (la_nLabels_ lap)) r tickvs = map fromRational $ steps (fromIntegral (la_nTicks_ lap))@@ -138,7 +141,7 @@ ---------------------------------------------------------------------- -defaultLogAxis :: Show a => LogAxisParams a+defaultLogAxis :: (Show a, RealFloat a) => LogAxisParams a defaultLogAxis = LogAxisParams { loga_labelf_ = showD }
Graphics/Rendering/Chart/Axis/Types.hs view
@@ -34,10 +34,12 @@ invLinMap, axisGridAtTicks,+ axisGridAtBigTicks, axisGridAtLabels, axisGridHide, axisTicksHide, axisLabelsHide,+ axisLabelsOverride, axis_viewport, axis_tropweiv,@@ -55,6 +57,7 @@ import qualified Graphics.Rendering.Cairo as C import Data.Time import Data.Fixed+import Data.Maybe import System.Locale (defaultTimeLocale) import Control.Monad import Data.List(sort,intersperse)@@ -130,16 +133,23 @@ } -- | Modifier to remove grid lines from an axis-axisGridHide :: AxisData x -> AxisData x-axisGridHide ad = ad{ axis_grid_ = [] }+axisGridHide :: AxisData x -> AxisData x+axisGridHide ad = ad{ axis_grid_ = [] } -- | Modifier to position grid lines to line up with the ticks-axisGridAtTicks :: AxisData x -> AxisData x-axisGridAtTicks ad = ad{ axis_grid_ = map fst (axis_ticks_ ad) }+axisGridAtTicks :: AxisData x -> AxisData x+axisGridAtTicks ad = ad{ axis_grid_ = map fst (axis_ticks_ ad) } +-- | Modifier to position grid lines to line up with only the major ticks+axisGridAtBigTicks :: AxisData x -> AxisData x+axisGridAtBigTicks ad = ad{ axis_grid_ =+ map fst $+ filter ((> minimum (map (abs.snd) (axis_ticks_ ad))).snd) $+ axis_ticks_ ad }+ -- | Modifier to position grid lines to line up with the labels-axisGridAtLabels :: AxisData x -> AxisData x-axisGridAtLabels ad = ad{ axis_grid_ = map fst vs }+axisGridAtLabels :: AxisData x -> AxisData x+axisGridAtLabels ad = ad{ axis_grid_ = map fst vs } where vs = case axis_labels_ ad of [] -> []@@ -153,6 +163,10 @@ axisLabelsHide :: AxisData x -> AxisData x axisLabelsHide ad = ad{ axis_labels_ = []} +-- | Modifier to change labels on an axis+axisLabelsOverride :: [(x,String)] -> AxisData x -> AxisData x+axisLabelsOverride o ad = ad{ axis_labels_ = [o] }+ minsizeAxis :: AxisT x -> CRender RectSize minsizeAxis (AxisT at as rev ad) = do labelSizes <- preserveCState $ do@@ -235,7 +249,8 @@ avoidOverlaps labels = do rects <- mapM labelDrawRect labels- return $ map snd . head . filter (noOverlaps . map fst) $ map (\n -> eachNth n rects) [0 .. length rects]+ return $ map snd . head . filter (noOverlaps . map fst)+ $ map (\n -> eachNth n rects) [0 .. length rects] labelDrawRect (value,s) = do let pt = axisPoint value `pvadd` (awayFromAxis ag)
− Graphics/Rendering/Chart/Gtk.hs
@@ -1,81 +0,0 @@--------------------------------------------------------------------------------- |--- Module : Graphics.Rendering.Chart.Gtk--- Copyright : (c) Tim Docker 2006--- License : BSD-style (see chart/COPYRIGHT)--module Graphics.Rendering.Chart.Gtk(- renderableToWindow,- createRenderableWindow,- updateCanvas- ) where--import qualified Graphics.UI.Gtk as G-import qualified Graphics.UI.Gtk.Gdk.Events as GE-import qualified Graphics.Rendering.Cairo as C-import Graphics.Rendering.Chart-import Graphics.Rendering.Chart.Renderable-import Graphics.Rendering.Chart.Types-import Data.List (isPrefixOf)-import Data.IORef-import Control.Monad(when)-import System.IO.Unsafe(unsafePerformIO)---- do action m for any keypress (except meta keys)-anyKey :: (Monad m) => m a -> GE.Event -> m Bool-anyKey m (GE.Key {GE.eventKeyName=key})- | any (`isPrefixOf` key) ignores = return True- | otherwise = m >> return True- where ignores = ["Shift","Control","Alt",- "Super","Meta","Hyper"]---- Yuck. But we really want the convenience function--- renderableToWindow as to be callable without requiring--- initGUI to be called first. But newer versions of--- gtk insist that initGUI is only called once-guiInitVar :: IORef Bool-{-# NOINLINE guiInitVar #-}-guiInitVar = unsafePerformIO (newIORef False)--initGuiOnce :: IO ()-initGuiOnce = do- v <- readIORef guiInitVar- when (not v) $ do- -- G.initGUI- G.unsafeInitGUIForThreadedRTS- writeIORef guiInitVar True---- | Display a renderable in a gtk window.------ Note that this is a convenience function that initialises GTK on--- it's first call, but not subsequent calls. Hence it's --- unlikely to be compatible with other code using gtk. In --- that case use createRenderableWindow.-renderableToWindow :: Renderable a -> Int -> Int -> IO ()-renderableToWindow chart windowWidth windowHeight = do- initGuiOnce- window <- createRenderableWindow chart windowWidth windowHeight- -- press any key to exit the loop- G.onKeyPress window $ anyKey (G.widgetDestroy window)- G.onDestroy window G.mainQuit- G.widgetShowAll window- G.mainGUI---- | Create a new GTK window displaying a renderable.-createRenderableWindow :: Renderable a -> Int -> Int -> IO G.Window-createRenderableWindow chart windowWidth windowHeight = do- window <- G.windowNew- canvas <- G.drawingAreaNew- G.widgetSetSizeRequest window windowWidth windowHeight- G.onExpose canvas $ const (updateCanvas chart canvas)- G.set window [G.containerChild G.:= canvas]- return window---updateCanvas :: Renderable a -> G.DrawingArea -> IO Bool-updateCanvas chart canvas = do- win <- G.widgetGetDrawWindow canvas- (width, height) <- G.widgetGetSize canvas- let sz = (fromIntegral width,fromIntegral height)- G.renderWithDrawable win $ runCRender (render chart sz) bitmapEnv- return True
Graphics/Rendering/Chart/Layout.hs view
@@ -140,7 +140,10 @@ data Layout1Pick x y = L1P_Legend String | L1P_Title String- | L1P_AxisTitle String+ | L1P_BottomAxisTitle String+ | L1P_TopAxisTitle String+ | L1P_LeftAxisTitle String+ | L1P_RightAxisTitle String | L1P_PlotArea x y y | L1P_BottomAxis x | L1P_TopAxis x@@ -266,16 +269,16 @@ , besideN [er, er, btitle, er, er ] ] - ttitle = atitle HTA_Centre VTA_Bottom 0 layout1_top_axis_- btitle = atitle HTA_Centre VTA_Top 0 layout1_bottom_axis_- ltitle = atitle HTA_Right VTA_Centre 270 layout1_left_axis_- rtitle = atitle HTA_Left VTA_Centre 270 layout1_right_axis_+ ttitle = atitle HTA_Centre VTA_Bottom 0 layout1_top_axis_ L1P_TopAxisTitle+ btitle = atitle HTA_Centre VTA_Top 0 layout1_bottom_axis_ L1P_BottomAxisTitle+ ltitle = atitle HTA_Right VTA_Centre 270 layout1_left_axis_ L1P_LeftAxisTitle+ rtitle = atitle HTA_Left VTA_Centre 270 layout1_right_axis_ L1P_RightAxisTitle er = tval $ emptyRenderable - atitle ha va rot af = if ttext == "" then er- else tval $ mapPickFn L1P_AxisTitle- $ rlabel tstyle ha va rot ttext+ atitle ha va rot af pf = if ttext == "" then er+ else tval $ mapPickFn pf+ $ rlabel tstyle ha va rot ttext where tstyle = laxis_title_style_ (af l) ttext = laxis_title_ (af l)@@ -339,15 +342,15 @@ in plot_render_ p pmfn rPlot1 _ _ _ = return () - pickfn (Point x y) = Just (L1P_PlotArea xv yv1 yv2)+ pickfn (Point x y) = case (lAxis,rAxis) of+ (Just at,Nothing) -> Just $ L1P_PlotArea xv (mapy at y) (mapy at y)+ (Nothing,Just at) -> Just $ L1P_PlotArea xv (mapy at y) (mapy at y)+ (Just at1,Just at2) -> Just $ L1P_PlotArea xv (mapy at1 y) (mapy at2 y)+ (Nothing,Nothing) -> Nothing where xv = case (bAxis,tAxis) of (Just at,_) -> mapx at x (_,Just at) -> mapx at x- (yv1,yv2) = case (lAxis,rAxis) of- (Just at,Nothing) -> (mapy at y,mapy at y)- (Nothing,Just at) -> (mapy at y,mapy at y)- (Just at1,Just at2) -> (mapy at1 y,mapy at2 y) mapx (AxisT _ _ rev ad) x = axis_tropweiv_ ad (reverse rev xr) x mapy (AxisT _ _ rev ad) y = axis_tropweiv_ ad (reverse rev yr) y
Graphics/Rendering/Chart/Renderable.hs view
@@ -31,6 +31,7 @@ spacer, spacer1, setPickFn,+ mapMaybePickFn, mapPickFn, nullPickFn, @@ -95,10 +96,14 @@ setPickFn :: PickFn b -> Renderable a -> Renderable b setPickFn pickfn r = r{ render = \sz -> do { render r sz; return pickfn; } } +-- | Map a function over the result of a renderable's pickfunction, keeping only 'Just' results.+mapMaybePickFn :: (a -> Maybe b) -> Renderable a -> Renderable b+mapMaybePickFn f r = r{ render = \sz -> do pf <- render r sz+ return (join . fmap f . pf) }+ -- | Map a function over result of a renderable's pickfunction. mapPickFn :: (a -> b) -> Renderable a -> Renderable b-mapPickFn f r = r{ render = \sz -> do pf <- render r sz- return (fmap f . pf) }+mapPickFn f = mapMaybePickFn (Just . f) -- | Add some spacing at the edges of a renderable. addMargins :: (Double,Double,Double,Double) -- ^ The spacing to be added.
Graphics/Rendering/Chart/Simple.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.Chart.Simple@@ -12,8 +11,7 @@ -- four plotting functions, which differ only in their output. One -- produces a "Layout1" that you can customize using other -- Graphics.Rendering.Chart functions. The other three produce their--- output directly. All three accept the same input (except for the--- filename required by plotPDF and plotPS), and produce the same plots.+-- output directly. All three accept the same input and produce the same plots. -- -- The plot functions accept a variable number of arguments. You must -- provide a [Double] which defines the points on the x axis, which must@@ -23,313 +21,13 @@ -- -- Examples: ----- > renderableToWindow (toRenderable $ plotLayout $--- > plot [0,0.1..10] sin "sin(x)") 640 480------ > plotWindow [0,1,3,4,8] [12,15,1,5,8] "o" "points"--- -- > plotPDF "foo.pdf" [0,0.1..10] sin "- " cos ". " cos "o" -- -- > plotPS "foo.ps" [0,0.1..10] (sin . exp) "- " (sin . exp) "o-" ----------------------------------------------------------------------------- module Graphics.Rendering.Chart.Simple( plot, PlotKind(..), xcoords,-#if HAVE_GTK- plotWindow,-#endif plotPDF, plotPS, plotLayout, plotPNG, Layout1DDD ) where -import Data.Maybe ( catMaybes )-import Data.Colour-import Data.Colour.Names--import Graphics.Rendering.Chart-#if HAVE_GTK-import Graphics.Rendering.Chart.Gtk-#endif--styleColor :: Int -> AlphaColour Double-styleColor ind = colorSequence !! ind- where colorSequence = cycle $ map opaque [ blue, red, green, yellow- , cyan, magenta, black ]--styleSymbol :: Int -> PlotKind-styleSymbol ind = symbolSequence !! ind- where symbolSequence = cycle [ Ex, HollowCircle, Square, Diamond- , Triangle, DownTriangle, Plus, Star- , FilledCircle ]---- When defaultLayout1 has been generalized, change this signature to --- [InternalPlot x y] -> Layout1 x y z-iplot :: [InternalPlot Double Double] -> Layout1 Double Double-iplot foobar = defaultLayout1 {- layout1_plots_ = concat $ zipWith toplot (ip foobar) [0..]- }- where- ip (xs@(IPX _ _):xyss) = map (\ys -> (xs,ys)) yss ++ ip rest- where yss = takeWhile isIPY xyss- rest = dropWhile isIPY xyss- ip (_:xyss) = ip xyss- ip [] = []- isIPY (IPY _ _) = True- isIPY _ = False- toplot (IPX xs _, IPY ys yks) ind = map Left plots- where- vs = zip xs ys- plots = case catMaybes $ map plotas yks of- [] -> [ toPlot $ defaultPlotLines- { plot_lines_title_ = name yks,- plot_lines_values_ = [vs],- plot_lines_style_ = solidLine 1 (styleColor ind)- } ]- xs -> xs- plotas Solid = Just $ toPlot $ defaultPlotLines- { plot_lines_title_ = name yks,- plot_lines_values_ = [vs],- plot_lines_style_ = solidLine 1 (styleColor ind) }- plotas Dashed = Just $ toPlot $ defaultPlotLines- { plot_lines_title_ = name yks,- plot_lines_values_ = [vs],- plot_lines_style_ = dashedLine 1 [10,10]- (styleColor ind) }- plotas Dotted = Just $ toPlot $ defaultPlotLines- { plot_lines_title_ = name yks,- plot_lines_values_ = [vs],- plot_lines_style_ = dashedLine 1 [1,11]- (styleColor ind) }- plotas FilledCircle = Just $ toPlot $ defaultPlotPoints- { plot_points_title_ = name yks,- plot_points_values_ = vs,- plot_points_style_ = filledCircles 4- (styleColor ind) }- plotas HollowCircle = Just $ toPlot $ defaultPlotPoints- { plot_points_title_ = name yks,- plot_points_values_ = vs,- plot_points_style_ = hollowCircles 5 1- (styleColor ind) }- plotas Triangle = Just $ toPlot $ defaultPlotPoints- { plot_points_title_ = name yks,- plot_points_values_ = vs,- plot_points_style_ = hollowPolygon 7 1 3 False- (styleColor ind) }- plotas DownTriangle = Just $ toPlot $ defaultPlotPoints- { plot_points_title_ = name yks,- plot_points_values_ = vs,- plot_points_style_ = hollowPolygon 7 1 3 True- (styleColor ind) }- plotas Square = Just $ toPlot $ defaultPlotPoints- { plot_points_title_ = name yks,- plot_points_values_ = vs,- plot_points_style_ = hollowPolygon 7 1 4 False- (styleColor ind) }- plotas Diamond = Just $ toPlot $ defaultPlotPoints- { plot_points_title_ = name yks,- plot_points_values_ = vs,- plot_points_style_ = hollowPolygon 7 1 4 True- (styleColor ind) }- plotas Plus = Just $ toPlot $ defaultPlotPoints- { plot_points_title_ = name yks,- plot_points_values_ = vs,- plot_points_style_ = plusses 7 1 (styleColor ind) }- plotas Ex = Just $ toPlot $ defaultPlotPoints- { plot_points_title_ = name yks,- plot_points_values_ = vs,- plot_points_style_ = exes 7 1 (styleColor ind) }- plotas Star = Just $ toPlot $ defaultPlotPoints- { plot_points_title_ = name yks,- plot_points_values_ = vs,- plot_points_style_ = stars 7 1 (styleColor ind) }- plotas Symbols = plotas (styleSymbol ind)- plotas _ = Nothing--name :: [PlotKind] -> String-name (Name s:_) = s-name (_:ks) = name ks-name [] = ""--str2k :: String -> [PlotKind]-str2k "" = []-str2k ". " = [Dotted]-str2k s@('?':_) = str2khelper s Symbols-str2k s@('@':_) = str2khelper s FilledCircle-str2k s@('#':_) = str2khelper s Square-str2k s@('v':_) = str2khelper s DownTriangle-str2k s@('^':_) = str2khelper s Triangle-str2k s@('o':_) = str2khelper s HollowCircle-str2k s@('+':_) = str2khelper s Plus-str2k s@('x':_) = str2khelper s Ex-str2k s@('*':_) = str2khelper s Star-str2k s@('.':_) = str2khelper s LittleDot-str2k "- " = [Dashed]-str2k "-" = [Solid]-str2k n = [Name n]--str2khelper :: String -> PlotKind -> [PlotKind]-str2khelper s@(_:r) x = case str2k r of- [] -> [x]- [Name _] -> [Name s]- xs -> x:xs---- | Type to define a few simple properties of each plot.-data PlotKind = Name String | FilledCircle | HollowCircle- | Triangle | DownTriangle | Square | Diamond- | Plus | Ex | Star | Symbols- | LittleDot | Dashed | Dotted | Solid- deriving ( Eq, Show, Ord )-data InternalPlot x y = IPY [y] [PlotKind] | IPX [x] [PlotKind]--newtype Layout1DDD = Layout1DDD { plotLayout :: Layout1 Double Double }-instance ToRenderable Layout1DDD where- toRenderable = toRenderable . plotLayout--uplot :: [UPlot] -> Layout1DDD-uplot us = Layout1DDD $ iplot $ nameDoubles $ evalfuncs us- where- nameDoubles :: [UPlot] -> [InternalPlot Double Double]- nameDoubles (X xs: uus) = case grabName uus of- (ks,uus') -> IPX (filter isValidNumber xs) ks- : nameDoubles uus'- nameDoubles (UDoubles xs:uus)= case grabName uus of- (ks,uus') -> IPY (filter isValidNumber xs) ks- : nameDoubles uus'- nameDoubles (_:uus) = nameDoubles uus- nameDoubles [] = []- evalfuncs :: [UPlot] -> [UPlot]- evalfuncs (UDoubles xs:uus) = X xs : map ef (takeWhile (not.isX) uus)- ++ evalfuncs (dropWhile (not.isX) uus)- where ef (UFunction f) = UDoubles (map f xs)- ef u = u- evalfuncs (X xs:uus) = X xs : map ef (takeWhile (not.isX) uus)- ++ evalfuncs (dropWhile (not.isX) uus)- where ef (UFunction f) = UDoubles (map f xs)- ef u = u- evalfuncs (u:uus) = u : evalfuncs uus- evalfuncs [] = []- grabName :: [UPlot] -> ([PlotKind],[UPlot])- grabName (UString n:uus) = case grabName uus of- (ks,uus') -> (str2k n++ks,uus')- grabName (UKind ks:uus) = case grabName uus of- (ks',uus') -> (ks++ks',uus')- grabName uus = ([],uus)- isX (X _) = True- isX _ = False---- | The main plotting function. The idea behind PlotType is shamelessly--- copied from Text.Printf (and is not exported). All you need to know is--- that your arguments need to be in class PlotArg. And PlotArg consists--- of functions and [Double] and String and PlotKind or [PlotKind].--plot :: PlotType a => a-plot = pl []-class PlotType t where- pl :: [UPlot] -> t-instance (PlotArg a, PlotType r) => PlotType (a -> r) where- pl args = \ a -> pl (toUPlot a ++ args)-instance PlotType Layout1DDD where- pl args = uplot (reverse args)--#if HAVE_GTK--- | Display a plot on the screen.--plotWindow :: PlotWindowType a => a-plotWindow = plw []-class PlotWindowType t where- plw :: [UPlot] -> t-instance (PlotArg a, PlotWindowType r) => PlotWindowType (a -> r) where- plw args = \ a -> plw (toUPlot a ++ args)-instance PlotWindowType (IO a) where- plw args = do- renderableToWindow (toRenderable $ uplot (reverse args)) 640 480- return undefined-#endif---- | Save a plot as a PDF file.--plotPDF :: PlotPDFType a => String -> a-plotPDF fn = pld fn []-class PlotPDFType t where- pld :: FilePath -> [UPlot] -> t-instance (PlotArg a, PlotPDFType r) => PlotPDFType (a -> r) where- pld fn args = \ a -> pld fn (toUPlot a ++ args)-instance PlotPDFType (IO a) where- pld fn args = do- renderableToPDFFile (toRenderable $ uplot (reverse args)) 640 480 fn- return undefined---- | Save a plot as a postscript file.--plotPS :: PlotPSType a => String -> a-plotPS fn = pls fn []-class PlotPSType t where- pls :: FilePath -> [UPlot] -> t-instance (PlotArg a, PlotPSType r) => PlotPSType (a -> r) where- pls fn args = \ a -> pls fn (toUPlot a ++ args)-instance PlotPSType (IO a) where- pls fn args = do- renderableToPSFile (toRenderable $ uplot (reverse args)) 640 480 fn- return undefined---- | Save a plot as a png file.-plotPNG :: PlotPNGType a => String -> a-plotPNG fn = plp fn []--class PlotPNGType t where- plp :: FilePath -> [UPlot] -> t-instance (PlotArg a, PlotPNGType r) => PlotPNGType (a -> r) where- plp fn args = \ a -> plp fn (toUPlot a ++ args)-instance PlotPNGType (IO a) where- plp fn args = do- renderableToPNGFile (toRenderable $ uplot (reverse args)) 640 480 fn- return undefined----data UPlot = UString String | UDoubles [Double] | UFunction (Double -> Double)- | UKind [PlotKind] | X [Double]--xcoords :: [Double] -> UPlot-xcoords = X--class PlotArg a where- toUPlot :: a -> [UPlot]--instance IsPlot p => PlotArg [p] where- toUPlot = toUPlot'--instance (Real a, Real b, Fractional a, Fractional b) => PlotArg (a -> b) where- toUPlot x = [UFunction (realToFrac . x . realToFrac)]--instance (Real a, Real b, Fractional a, Fractional b) => IsPlot (a -> b) where- toUPlot' = reverse . concatMap f- where f x = [UFunction (realToFrac . x . realToFrac)]--instance PlotArg UPlot where- toUPlot = (:[])--instance PlotArg PlotKind where- toUPlot = (:[]) . UKind . (:[])---class IsPlot c where- toUPlot' :: [c] -> [UPlot]--instance IsPlot PlotKind where- toUPlot' = (:[]) . UKind--instance IsPlot Double where- toUPlot' = (:[]) . UDoubles--instance IsPlot Char where- toUPlot' = (:[]) . UString--instance IsPlot p => IsPlot [p] where- toUPlot' = reverse . concatMap toUPlot'--instance (IsPlot p, IsPlot q, IsPlot r) => IsPlot (p,q,r) where- toUPlot' = reverse . concatMap f- where f (p,q,r) = toUPlot' [p] ++ toUPlot' [q] ++ toUPlot' [r]--instance (IsPlot p, IsPlot q) => IsPlot (p,q) where- toUPlot' = reverse . concatMap f- where f (p,q) = toUPlot' [p] ++ toUPlot' [q]+import Graphics.Rendering.Chart.Simple.Internal
+ Graphics/Rendering/Chart/Simple/Internal.hs view
@@ -0,0 +1,277 @@+module Graphics.Rendering.Chart.Simple.Internal where++import Data.Maybe ( catMaybes )+import Data.Colour+import Data.Colour.Names++import Graphics.Rendering.Chart++styleColor :: Int -> AlphaColour Double+styleColor ind = colorSequence !! ind+ where colorSequence = cycle $ map opaque [ blue, red, green, yellow+ , cyan, magenta, black ]++styleSymbol :: Int -> PlotKind+styleSymbol ind = symbolSequence !! ind+ where symbolSequence = cycle [ Ex, HollowCircle, Square, Diamond+ , Triangle, DownTriangle, Plus, Star+ , FilledCircle ]++-- When defaultLayout1 has been generalized, change this signature to +-- [InternalPlot x y] -> Layout1 x y z+iplot :: [InternalPlot Double Double] -> Layout1 Double Double+iplot foobar = defaultLayout1 {+ layout1_plots_ = concat $ zipWith toplot (ip foobar) [0..]+ }+ where+ ip (xs@(IPX _ _):xyss) = map (\ys -> (xs,ys)) yss ++ ip rest+ where yss = takeWhile isIPY xyss+ rest = dropWhile isIPY xyss+ ip (_:xyss) = ip xyss+ ip [] = []+ isIPY (IPY _ _) = True+ isIPY _ = False+ toplot (IPX xs _, IPY ys yks) ind = map Left plots+ where+ vs = zip xs ys+ plots = case catMaybes $ map plotas yks of+ [] -> [ toPlot $ defaultPlotLines+ { plot_lines_title_ = name yks,+ plot_lines_values_ = [vs],+ plot_lines_style_ = solidLine 1 (styleColor ind)+ } ]+ xs -> xs+ plotas Solid = Just $ toPlot $ defaultPlotLines+ { plot_lines_title_ = name yks,+ plot_lines_values_ = [vs],+ plot_lines_style_ = solidLine 1 (styleColor ind) }+ plotas Dashed = Just $ toPlot $ defaultPlotLines+ { plot_lines_title_ = name yks,+ plot_lines_values_ = [vs],+ plot_lines_style_ = dashedLine 1 [10,10]+ (styleColor ind) }+ plotas Dotted = Just $ toPlot $ defaultPlotLines+ { plot_lines_title_ = name yks,+ plot_lines_values_ = [vs],+ plot_lines_style_ = dashedLine 1 [1,11]+ (styleColor ind) }+ plotas FilledCircle = Just $ toPlot $ defaultPlotPoints+ { plot_points_title_ = name yks,+ plot_points_values_ = vs,+ plot_points_style_ = filledCircles 4+ (styleColor ind) }+ plotas HollowCircle = Just $ toPlot $ defaultPlotPoints+ { plot_points_title_ = name yks,+ plot_points_values_ = vs,+ plot_points_style_ = hollowCircles 5 1+ (styleColor ind) }+ plotas Triangle = Just $ toPlot $ defaultPlotPoints+ { plot_points_title_ = name yks,+ plot_points_values_ = vs,+ plot_points_style_ = hollowPolygon 7 1 3 False+ (styleColor ind) }+ plotas DownTriangle = Just $ toPlot $ defaultPlotPoints+ { plot_points_title_ = name yks,+ plot_points_values_ = vs,+ plot_points_style_ = hollowPolygon 7 1 3 True+ (styleColor ind) }+ plotas Square = Just $ toPlot $ defaultPlotPoints+ { plot_points_title_ = name yks,+ plot_points_values_ = vs,+ plot_points_style_ = hollowPolygon 7 1 4 False+ (styleColor ind) }+ plotas Diamond = Just $ toPlot $ defaultPlotPoints+ { plot_points_title_ = name yks,+ plot_points_values_ = vs,+ plot_points_style_ = hollowPolygon 7 1 4 True+ (styleColor ind) }+ plotas Plus = Just $ toPlot $ defaultPlotPoints+ { plot_points_title_ = name yks,+ plot_points_values_ = vs,+ plot_points_style_ = plusses 7 1 (styleColor ind) }+ plotas Ex = Just $ toPlot $ defaultPlotPoints+ { plot_points_title_ = name yks,+ plot_points_values_ = vs,+ plot_points_style_ = exes 7 1 (styleColor ind) }+ plotas Star = Just $ toPlot $ defaultPlotPoints+ { plot_points_title_ = name yks,+ plot_points_values_ = vs,+ plot_points_style_ = stars 7 1 (styleColor ind) }+ plotas Symbols = plotas (styleSymbol ind)+ plotas _ = Nothing++name :: [PlotKind] -> String+name (Name s:_) = s+name (_:ks) = name ks+name [] = ""++str2k :: String -> [PlotKind]+str2k "" = []+str2k ". " = [Dotted]+str2k s@('?':_) = str2khelper s Symbols+str2k s@('@':_) = str2khelper s FilledCircle+str2k s@('#':_) = str2khelper s Square+str2k s@('v':_) = str2khelper s DownTriangle+str2k s@('^':_) = str2khelper s Triangle+str2k s@('o':_) = str2khelper s HollowCircle+str2k s@('+':_) = str2khelper s Plus+str2k s@('x':_) = str2khelper s Ex+str2k s@('*':_) = str2khelper s Star+str2k s@('.':_) = str2khelper s LittleDot+str2k "- " = [Dashed]+str2k "-" = [Solid]+str2k n = [Name n]++str2khelper :: String -> PlotKind -> [PlotKind]+str2khelper s@(_:r) x = case str2k r of+ [] -> [x]+ [Name _] -> [Name s]+ xs -> x:xs++-- | Type to define a few simple properties of each plot.+data PlotKind = Name String | FilledCircle | HollowCircle+ | Triangle | DownTriangle | Square | Diamond+ | Plus | Ex | Star | Symbols+ | LittleDot | Dashed | Dotted | Solid+ deriving ( Eq, Show, Ord )+data InternalPlot x y = IPY [y] [PlotKind] | IPX [x] [PlotKind]++newtype Layout1DDD = Layout1DDD { plotLayout :: Layout1 Double Double }+instance ToRenderable Layout1DDD where+ toRenderable = toRenderable . plotLayout++uplot :: [UPlot] -> Layout1DDD+uplot us = Layout1DDD $ iplot $ nameDoubles $ evalfuncs us+ where+ nameDoubles :: [UPlot] -> [InternalPlot Double Double]+ nameDoubles (X xs: uus) = case grabName uus of+ (ks,uus') -> IPX (filter isValidNumber xs) ks+ : nameDoubles uus'+ nameDoubles (UDoubles xs:uus)= case grabName uus of+ (ks,uus') -> IPY (filter isValidNumber xs) ks+ : nameDoubles uus'+ nameDoubles (_:uus) = nameDoubles uus+ nameDoubles [] = []+ evalfuncs :: [UPlot] -> [UPlot]+ evalfuncs (UDoubles xs:uus) = X xs : map ef (takeWhile (not.isX) uus)+ ++ evalfuncs (dropWhile (not.isX) uus)+ where ef (UFunction f) = UDoubles (map f xs)+ ef u = u+ evalfuncs (X xs:uus) = X xs : map ef (takeWhile (not.isX) uus)+ ++ evalfuncs (dropWhile (not.isX) uus)+ where ef (UFunction f) = UDoubles (map f xs)+ ef u = u+ evalfuncs (u:uus) = u : evalfuncs uus+ evalfuncs [] = []+ grabName :: [UPlot] -> ([PlotKind],[UPlot])+ grabName (UString n:uus) = case grabName uus of+ (ks,uus') -> (str2k n++ks,uus')+ grabName (UKind ks:uus) = case grabName uus of+ (ks',uus') -> (ks++ks',uus')+ grabName uus = ([],uus)+ isX (X _) = True+ isX _ = False++-- | The main plotting function. The idea behind PlotType is shamelessly+-- copied from Text.Printf (and is not exported). All you need to know is+-- that your arguments need to be in class PlotArg. And PlotArg consists+-- of functions and [Double] and String and PlotKind or [PlotKind].++plot :: PlotType a => a+plot = pl []+class PlotType t where+ pl :: [UPlot] -> t+instance (PlotArg a, PlotType r) => PlotType (a -> r) where+ pl args = \ a -> pl (toUPlot a ++ args)+instance PlotType Layout1DDD where+ pl args = uplot (reverse args)++-- | Save a plot as a PDF file.++plotPDF :: PlotPDFType a => String -> a+plotPDF fn = pld fn []+class PlotPDFType t where+ pld :: FilePath -> [UPlot] -> t+instance (PlotArg a, PlotPDFType r) => PlotPDFType (a -> r) where+ pld fn args = \ a -> pld fn (toUPlot a ++ args)+instance PlotPDFType (IO a) where+ pld fn args = do+ renderableToPDFFile (toRenderable $ uplot (reverse args)) 640 480 fn+ return undefined++-- | Save a plot as a postscript file.++plotPS :: PlotPSType a => String -> a+plotPS fn = pls fn []+class PlotPSType t where+ pls :: FilePath -> [UPlot] -> t+instance (PlotArg a, PlotPSType r) => PlotPSType (a -> r) where+ pls fn args = \ a -> pls fn (toUPlot a ++ args)+instance PlotPSType (IO a) where+ pls fn args = do+ renderableToPSFile (toRenderable $ uplot (reverse args)) 640 480 fn+ return undefined++-- | Save a plot as a png file.+plotPNG :: PlotPNGType a => String -> a+plotPNG fn = plp fn []++class PlotPNGType t where+ plp :: FilePath -> [UPlot] -> t+instance (PlotArg a, PlotPNGType r) => PlotPNGType (a -> r) where+ plp fn args = \ a -> plp fn (toUPlot a ++ args)+instance PlotPNGType (IO a) where+ plp fn args = do+ renderableToPNGFile (toRenderable $ uplot (reverse args)) 640 480 fn+ return undefined++++data UPlot = UString String | UDoubles [Double] | UFunction (Double -> Double)+ | UKind [PlotKind] | X [Double]++xcoords :: [Double] -> UPlot+xcoords = X++class PlotArg a where+ toUPlot :: a -> [UPlot]++instance IsPlot p => PlotArg [p] where+ toUPlot = toUPlot'++instance (Real a, Real b, Fractional a, Fractional b) => PlotArg (a -> b) where+ toUPlot x = [UFunction (realToFrac . x . realToFrac)]++instance (Real a, Real b, Fractional a, Fractional b) => IsPlot (a -> b) where+ toUPlot' = reverse . concatMap f+ where f x = [UFunction (realToFrac . x . realToFrac)]++instance PlotArg UPlot where+ toUPlot = (:[])++instance PlotArg PlotKind where+ toUPlot = (:[]) . UKind . (:[])+++class IsPlot c where+ toUPlot' :: [c] -> [UPlot]++instance IsPlot PlotKind where+ toUPlot' = (:[]) . UKind++instance IsPlot Double where+ toUPlot' = (:[]) . UDoubles++instance IsPlot Char where+ toUPlot' = (:[]) . UString++instance IsPlot p => IsPlot [p] where+ toUPlot' = reverse . concatMap toUPlot'++instance (IsPlot p, IsPlot q, IsPlot r) => IsPlot (p,q,r) where+ toUPlot' = reverse . concatMap f+ where f (p,q,r) = toUPlot' [p] ++ toUPlot' [q] ++ toUPlot' [r]++instance (IsPlot p, IsPlot q) => IsPlot (p,q) where+ toUPlot' = reverse . concatMap f+ where f (p,q) = toUPlot' [p] ++ toUPlot' [q]
tests/Test1.hs view
@@ -1,7 +1,6 @@ module Test1 where import Graphics.Rendering.Chart-import Graphics.Rendering.Chart.Gtk import Data.Colour import Data.Colour.Names import Data.Colour.SRGB@@ -34,7 +33,6 @@ main1 :: [String] -> IO (PickFn ()) main1 ["small"] = renderableToPNGFile (chart 0.25) 320 240 "test1_small.png" main1 ["big"] = renderableToPNGFile (chart 0.25) 800 600 "test1_big.png"-main1 _ = renderableToWindow (chart 1.00) 640 480 >> return undefined main = getArgs >>= main1
tests/Test14.hs view
@@ -1,7 +1,6 @@ module Test14 where import Graphics.Rendering.Chart-import Graphics.Rendering.Chart.Gtk import Data.Colour import Data.Colour.Names import Data.Accessor@@ -43,6 +42,5 @@ main1 :: [String] -> IO (PickFn ()) main1 ["small"] = renderableToPNGFile (chart 0.25) 320 240 "test14_small.png" main1 ["big"] = renderableToPNGFile (chart 0.25) 800 600 "test14_big.png"-main1 _ = renderableToWindow (chart 1.00) 640 480 >> return undefined main = getArgs >>= main1
tests/Test14a.hs view
@@ -1,7 +1,6 @@ module Test14a where import Graphics.Rendering.Chart-import Graphics.Rendering.Chart.Gtk import Graphics.Rendering.Chart.Plot import Data.Colour import Data.Colour.Names@@ -45,6 +44,5 @@ main1 :: [String] -> IO (PickFn ()) main1 ["small"] = renderableToPNGFile (chart 0.25) 320 240 "test14_small.png" main1 ["big"] = renderableToPNGFile (chart 0.25) 800 600 "test14_big.png"-main1 _ = renderableToWindow (chart 1.00) 640 480 >> return undefined main = getArgs >>= main1
tests/Test15.hs view
@@ -1,7 +1,6 @@ module Test15 where import Graphics.Rendering.Chart-import Graphics.Rendering.Chart.Gtk import Data.Colour import Data.Colour.Names import Data.Accessor@@ -38,7 +37,6 @@ main1 :: [String] -> IO (PickFn ()) main1 ["small"] = renderableToPNGFile (chart (LORows 3)) 320 240 "test15_small.png" main1 ["big"] = renderableToPNGFile (chart (LORows 3)) 800 600 "test15_big.png"-main1 _ = renderableToWindow (chart (LORows 3)) 640 480 >> return undefined main = getArgs >>= main1
tests/Test17.hs view
@@ -1,7 +1,6 @@ module Test17 where import Graphics.Rendering.Chart-import Graphics.Rendering.Chart.Gtk import Data.Colour import Data.Colour.Names import Data.Accessor@@ -75,8 +74,7 @@ $ defaultPlotLines ^. plot_lines_style main1 :: [String] -> IO (PickFn ())-main1 ["small"] = renderableToPNGFile (chart 0.25) 320 240 "test17_small.png"-main1 ["big"] = renderableToPNGFile (chart 0.25) 800 600 "test17_big.png"-main1 _ = renderableToWindow (chart 1.00) 640 480 >> return undefined+main1 ["small"] = renderableToPNGFile (chart 0.25) 320 240 "test1_small.png"+main1 ["big"] = renderableToPNGFile (chart 0.25) 800 600 "test1_big.png" main = getArgs >>= main1
tests/Test2.hs view
@@ -1,7 +1,6 @@ module Test2 where import Graphics.Rendering.Chart-import Graphics.Rendering.Chart.Gtk import Data.Time.LocalTime import Data.Colour import Data.Colour.Names@@ -59,6 +58,5 @@ main1 :: [String] -> IO (PickFn ()) main1 ["small"] = renderableToPNGFile (chart prices2 True 0.25) 320 240 "test2_small.png" main1 ["big"] = renderableToPNGFile (chart prices2 True 0.25) 800 600 "test2_big.png"-main1 _ = renderableToWindow (chart prices2 True 1.00) 640 480 >> return undefined main = getArgs >>= main1
tests/Test3.hs view
@@ -1,7 +1,6 @@ module Test3 where import Graphics.Rendering.Chart-import Graphics.Rendering.Chart.Gtk import Data.Time.LocalTime import Data.Colour import Data.Colour.Names@@ -35,6 +34,5 @@ main1 :: [String] -> IO (PickFn ()) main1 ["small"] = renderableToPNGFile chart 320 240 "test3_small.png" main1 ["big"] = renderableToPNGFile chart 800 600 "test3_big.png"-main1 _ = renderableToWindow chart 640 480 >> return undefined main = getArgs >>= main1
tests/Test4.hs view
@@ -1,7 +1,6 @@ module Test4 where import Graphics.Rendering.Chart-import Graphics.Rendering.Chart.Gtk import Data.Colour import Data.Colour.Names import Data.Accessor@@ -32,7 +31,6 @@ main1 :: [String] -> IO (PickFn ()) main1 ["small"] = renderableToPNGFile (chart False False) 320 240 "test4_small.png" main1 ["big"] = renderableToPNGFile (chart False False) 800 600 "test4_big.png"-main1 _ = renderableToWindow (chart False False) 640 480 >> return undefined main = getArgs >>= main1
tests/Test5.hs view
@@ -1,7 +1,6 @@ module Test5 where import Graphics.Rendering.Chart-import Graphics.Rendering.Chart.Gtk import Data.Colour import Data.Colour.Names import Data.Accessor@@ -43,7 +42,6 @@ main1 :: [String] -> IO (PickFn ()) main1 ["small"] = renderableToPNGFile (chart 0.25) 320 240 "test5_small.png" main1 ["big"] = renderableToPNGFile (chart 0.25) 800 600 "test5_big.png"-main1 _ = renderableToWindow (chart 1.00) 640 480 >> return undefined main = getArgs >>= main1
tests/Test6.hs view
@@ -2,7 +2,6 @@ import Graphics.Rendering.Chart import Graphics.Rendering.Chart.Simple-import Graphics.Rendering.Chart.Gtk import System.Environment(getArgs) chart :: Renderable ()@@ -19,6 +18,5 @@ main1 :: [String] -> IO (PickFn ()) main1 ["small"] = renderableToPNGFile chart 320 240 "test6_small.png" main1 ["big"] = renderableToPNGFile chart 800 600 "test6_big.png"-main1 _ = renderableToWindow chart 640 480 >> return undefined main = getArgs >>= main1
tests/Test7.hs view
@@ -1,7 +1,6 @@ module Test7 where import Graphics.Rendering.Chart-import Graphics.Rendering.Chart.Gtk import Data.Colour import Data.Colour.Names import Data.Accessor@@ -29,7 +28,6 @@ main1 :: [String] -> IO (PickFn ()) main1 ["small"] = renderableToPNGFile chart 320 240 "test7_small.png" main1 ["big"] = renderableToPNGFile chart 800 600 "test7_big.png"-main1 _ = renderableToWindow chart 640 480 >> return undefined main = getArgs >>= main1
tests/Test8.hs view
@@ -1,7 +1,6 @@ module Test8 where import Graphics.Rendering.Chart-import Graphics.Rendering.Chart.Gtk import Data.Accessor import System.Environment(getArgs) @@ -19,7 +18,6 @@ main1 :: [String] -> IO (PickFn ()) main1 ["small"] = renderableToPNGFile chart 320 240 "test8_small.png" main1 ["big"] = renderableToPNGFile chart 800 600 "test8_big.png"-main1 _ = renderableToWindow chart 640 480 >> return undefined main = getArgs >>= main1
tests/Test9.hs view
@@ -1,7 +1,6 @@ module Test9 where import Graphics.Rendering.Chart-import Graphics.Rendering.Chart.Gtk import Data.Colour import Data.Colour.Names import Data.Accessor@@ -33,7 +32,6 @@ main1 :: [String] -> IO (PickFn ()) main1 ["small"] = renderableToPNGFile (chart True) 320 240 "test9_small.png" main1 ["big"] = renderableToPNGFile (chart True) 800 600 "test9_big.png"-main1 _ = renderableToWindow (chart True) 640 480 >> return undefined main = getArgs >>= main1
tests/TestParametric.hs view
@@ -1,7 +1,6 @@ module TestParametric where import Graphics.Rendering.Chart-import Graphics.Rendering.Chart.Gtk import Data.Colour import Data.Colour.Names import Data.Accessor@@ -23,8 +22,7 @@ $ defaultLayout1 main1 :: [String] -> IO (PickFn ())-main1 ["small"] = renderableToPNGFile (chart 1.00) 320 240 "test_parametric_small.png"-main1 ["big"] = renderableToPNGFile (chart 1.00) 800 600 "test_parametric_big.png"-main1 _ = renderableToWindow (chart 1.00) 640 480 >> return undefined+main1 ["small"] = renderableToPNGFile (chart 0.25) 320 240 "test1_small.png"+main1 ["big"] = renderableToPNGFile (chart 0.25) 800 600 "test1_big.png" main = getArgs >>= main1
tests/all_tests.hs view
@@ -1,7 +1,6 @@ import qualified Graphics.Rendering.Cairo as C import Graphics.Rendering.Chart import Graphics.Rendering.Chart.Simple-import Graphics.Rendering.Chart.Gtk import Graphics.Rendering.Chart.Grid import System.Environment(getArgs)@@ -32,9 +31,8 @@ import qualified Test17 import qualified TestParametric -data OutputType = Window | PNG | PS | PDF | SVG+data OutputType = PNG | PS | PDF | SVG -chooseLineWidth Window = 1.0 chooseLineWidth PNG = 1.0 chooseLineWidth PDF = 0.25 chooseLineWidth PS = 0.25@@ -388,11 +386,11 @@ main1 args main1 :: [String] -> IO ()-main1 ("--png":tests) = showTests tests renderToPNG main1 ("--pdf":tests) = showTests tests renderToPDF main1 ("--svg":tests) = showTests tests renderToSVG main1 ("--ps":tests) = showTests tests renderToPS-main1 tests = showTests tests renderToWindow+main1 ("--png":tests) = showTests tests renderToPNG+main1 tests = showTests tests renderToPNG showTests :: [String] -> ((String,OutputType -> Renderable ()) -> IO()) -> IO () showTests tests ofn = mapM_ doTest (filter (match tests) allTests)@@ -406,7 +404,6 @@ match [] t = True match ts t = (fst t) `elem` ts -renderToWindow (n,ir) = renderableToWindow (ir Window) 640 480 renderToPNG (n,ir) = renderableToPNGFile (ir PNG) 640 480 (n ++ ".png") >> return () renderToPS (n,ir) = renderableToPSFile (ir PS) 640 480 (n ++ ".ps")