diff --git a/src/TernaryGraph.purs b/src/TernaryGraph.purs index 71ddd5c..188f83b 100644 --- a/src/TernaryGraph.purs +++ b/src/TernaryGraph.purs @@ -11,6 +11,7 @@ import Data.Number.Format (toString) import Data.List (fold) import Data.Ord ((<)) import Data.Ring (negate) +import Data.Set as Set import Data.Tuple.Nested (Tuple3, tuple3, get1, get2, get3) type Point = @@ -111,6 +112,15 @@ axesPath :: Point -> Point -> Point -> XMLFragment axesPath p1 p2 p3 = XMLFragment $ """ "d=\"M " <> (toString p1.x) <> "," <> (toString p1.y) <> " " <> (toString p2.x) <> "," <> (toString p2.y) <> " " <> (toString p3.x) <> "," <> (toString p3.y) <> " Z\"/>" +tickLabelStrings :: Int -> Int -> Int -> Int -> Set.Set String +tickLabelStrings numTicks axis1Start axis2Start axis3Start = + Set.map (\x -> "E" <> (toString (Int.toNumber x))) axisTicks + where + axis1Ticks = Set.fromFoldable (range axis1Start (axis1Start + numTicks - 1)) + axis2Ticks = Set.fromFoldable (range axis2Start (axis2Start + numTicks - 1)) + axis3Ticks = Set.fromFoldable (range axis3Start (axis3Start + numTicks - 1)) + axisTicks = Set.union (Set.union axis1Ticks axis2Ticks) axis3Ticks + ternaryGraph :: Number -> Number -> Number -> Int -> String ternaryGraph scale xOffset yOffset numTicks = ternaryGraphSvg fragments where