Import Int as module namespace

This commit is contained in:
Nathan McRae
2025-08-07 21:59:51 -07:00
parent c21baccba9
commit 4f4acfe6b2

View File

@@ -4,7 +4,7 @@ import Prelude ( discard, class Monoid, class Semigroup, Unit, ($), (<<<), (<>),
import Data.Array ((!!), concat, cons, mapWithIndex, range) import Data.Array ((!!), concat, cons, mapWithIndex, range)
import Data.Functor (map) import Data.Functor (map)
import Data.Int (toNumber) import Data.Int as Int
import Data.Maybe import Data.Maybe
import Data.Number (cos, pi, sin) import Data.Number (cos, pi, sin)
import Data.Number.Format (toString) import Data.Number.Format (toString)
@@ -70,8 +70,8 @@ getTick :: Number -> Int -> Int -> Line
getTick scale numTicks tickI = getTick scale numTicks tickI =
{start: {x: x, y: -(0.5 + 5.0 / scale)}, end: {x: x, y: y}} {start: {x: x, y: -(0.5 + 5.0 / scale)}, end: {x: x, y: y}}
where where
x = 2.0 * (sin (pi / 3.0)) * (toNumber tickI) / (toNumber numTicks) - (sin (pi / 3.0)) x = 2.0 * (sin (pi / 3.0)) * (Int.toNumber tickI) / (Int.toNumber numTicks) - (sin (pi / 3.0))
y = if tickI < numTicks / 2 y = if tickI <= numTicks / 2
then 1.0 + x * 1.5 / (sin (pi / 3.0)) then 1.0 + x * 1.5 / (sin (pi / 3.0))
else 1.0 - x * 1.5 / (sin (pi / 3.0)) else 1.0 - x * 1.5 / (sin (pi / 3.0))
@@ -138,7 +138,7 @@ ternaryGraph scale xOffset yOffset numTicks = ternaryGraphSvg fragments
-- TODO: tick label size -- TODO: tick label size
-- TODO: axis tick label rotation -- TODO: axis tick label rotation
-- TODO: axis tick start number -- TODO: axis tick start number
axisTickLabels = \rotation -> mapWithIndex (\i point -> svgText ("E" <> (toString (toNumber i))) 10.0 point 0.0) axisTickLabels = \rotation -> mapWithIndex (\i point -> svgText ("E" <> (toString (Int.toNumber i))) 10.0 point 0.0)
axis1TickLabels = axisTickLabels 0 $ axisTickStarts axis1TickLines axis1TickLabels = axisTickLabels 0 $ axisTickStarts axis1TickLines
axis2TickLabels = axisTickLabels 0 $ axisTickStarts axis2TickLines axis2TickLabels = axisTickLabels 0 $ axisTickStarts axis2TickLines