1111
1212module Graphics.Rendering.Chart.Axis.Indexed (
1313 PlotIndex (.. ),
14- PlotIndexRev (.. ),
1514 autoIndexAxis' ,
1615 autoIndexAxis ,
17- autoIndexTicksAxis ,
18- autoIndexRevAxis ,
19- autoIndexRevTicksAxis ,
2016 addIndexes ,
21- addRevIndexes ,
2217) where
2318
2419import Data.Default.Class
@@ -39,31 +34,16 @@ instance PlotValue PlotIndex where
3934addIndexes :: [a ] -> [(PlotIndex ,a )]
4035addIndexes = zipWith (\ n x -> (PlotIndex n, x)) [0 .. ]
4136
42- -- | Indices in a reverse order
43- newtype PlotIndexRev = PlotIndexRev { plotindexr_i :: Int }
44- deriving (Eq ,Ord ,Enum ,Num ,Real ,Integral ,Show )
45-
46- instance PlotValue PlotIndexRev where
47- toValue (PlotIndexRev i) = fromIntegral i
48- fromValue = PlotIndexRev . round
49- autoAxis = autoIndexRevAxis []
50-
51- -- | Augment a list of values with reversed index numbers for plotting.
52- addRevIndexes :: [a ] -> [(PlotIndexRev ,a )]
53- addRevIndexes xs =
54- let l = length xs in
55- zipWith (\ n x -> (PlotIndexRev (l - n - 1 ), x)) [0 .. ] xs
56-
5737-- | Create an axis for values indexed by position. The
5838-- list of strings are the labels to be used.
59- autoIndexAxis' :: Integral i => Bool -> Bool -> [String ] -> AxisFn i
60- autoIndexAxis' rev tks labels vs = AxisData {
39+ autoIndexAxis' :: Integral i => Bool -> [String ] -> AxisFn i
40+ autoIndexAxis' tks labels vs = AxisData {
6141 _axis_visibility = def { _axis_show_ticks = False },
6242 _axis_viewport = vport,
6343 _axis_tropweiv = invport,
6444 _axis_ticks = if tks then map (, 5 ) $ take (length labels) [0 .. ] else [] ,
6545 _axis_labels = [filter (\ (i,_) -> i >= imin && i <= imax)
66- (zip [0 .. ] ( if rev then reverse labels else labels) )],
46+ (zip [0 .. ] labels)],
6747 _axis_grid = []
6848 }
6949 where
@@ -74,13 +54,4 @@ autoIndexAxis' rev tks labels vs = AxisData {
7454 imax = maximum vs
7555
7656autoIndexAxis :: Integral i => [String ] -> AxisFn i
77- autoIndexAxis = autoIndexAxis' False False
78-
79- autoIndexTicksAxis :: Integral i => [String ] -> AxisFn i
80- autoIndexTicksAxis = autoIndexAxis' False True
81-
82- autoIndexRevAxis :: Integral i => [String ] -> AxisFn i
83- autoIndexRevAxis = autoIndexAxis' True False
84-
85- autoIndexRevTicksAxis :: Integral i => [String ] -> AxisFn i
86- autoIndexRevTicksAxis = autoIndexAxis' True True
57+ autoIndexAxis = autoIndexAxis' False
0 commit comments