Module

Hylograph.Scale.FP

Package
purescript-hylograph-selection
Repository
afcondon/purescript-hylograph-selection

Hylograph.Scale.FP - Functional Programming Abstractions for Scales

Higher-level functional programming idioms built on top of Scale.Pure. No FFI or D3 dependency.

Scale Modifiers

Scale modifiers compose:

niceAndClamped = combineModifiers [niceModifier, clampModifier]
myScale = linear # niceAndClamped # domain [...] # range [...]

Sampling

gradient = sample 100 viridisColorScale

#ScaleModifier Source

type ScaleModifier = ContinuousScale -> ContinuousScale

A scale modifier transforms a scale while preserving its type

#niceModifier Source

niceModifier :: ScaleModifier

Modifier that makes the domain nice (rounds to clean values)

#clampModifier Source

clampModifier :: ScaleModifier

Modifier that enables clamping

#roundModifier Source

roundModifier :: ScaleModifier

Modifier that enables rounding

#combineModifiers Source

combineModifiers :: Array ScaleModifier -> ScaleModifier

Combine multiple modifiers (apply left to right)

#sample Source

sample :: Int -> ContinuousScale -> Array Number

Sample a scale at n evenly-spaced points in [0, 1]

#sampleRange Source

sampleRange :: Int -> Number -> Number -> ContinuousScale -> Array Number

Sample within a specific range

#sampleWithDomain Source

sampleWithDomain :: Int -> ContinuousScale -> Array (Tuple Number Number)

Sample and return both domain and range values

#tickPositions Source

tickPositions :: Int -> ContinuousScale -> Array Number

Get tick positions as pixel coordinates

#tickLabels Source

tickLabels :: Int -> String -> ContinuousScale -> Array String

Get formatted tick labels

#ticksWithLabels Source

ticksWithLabels :: Int -> String -> ContinuousScale -> Array { label :: String, position :: Number }

Get ticks with both position and label

#blendInterpolators Source

blendInterpolators :: Number -> Interpolator String -> Interpolator String -> Interpolator String

Blend two interpolators together

#reverseInterpolator Source

reverseInterpolator :: forall a. Interpolator a -> Interpolator a

Reverse an interpolator (1-t instead of t)

#clampInterpolator Source

clampInterpolator :: forall a. Interpolator a -> Interpolator a

Clamp interpolator input to [0, 1]

#cycleInterpolator Source

cycleInterpolator :: forall a. Interpolator a -> Interpolator a

Make an interpolator cycle (values outside [0,1] wrap)

#normalize Source

normalize :: Number -> Number -> ContinuousScale

Create a normalizing scale (maps domain to [0, 1])

#quantize Source

quantize :: forall a. NonEmptyArray a -> Number -> Number -> Number -> a

Create a quantizing scale (continuous -> discrete buckets)

#threshold Source

threshold :: forall a. Array Number -> NonEmptyArray a -> Number -> a

Create a threshold scale with custom breakpoints

#scaleExtent Source

scaleExtent :: ContinuousScale -> { max :: Number, min :: Number }

Get the extent (min, max) of a scale's output for inputs in [0, 1]

#scaleMidpoint Source

scaleMidpoint :: ContinuousScale -> Number

Get the midpoint of a scale

#scaleInRange Source

scaleInRange :: ContinuousScale -> Number -> Boolean

Check if a value is within a scale's output range

Modules
Data.DependencyGraph
Hylograph.Brush
Hylograph.Brush.FFI
Hylograph.Brush.Types
Hylograph.Classify
Hylograph.Data.Graph
Hylograph.Data.Graph.Algorithms
Hylograph.Data.Node
Hylograph.Data.Tree
Hylograph.Expr.Animation
Hylograph.Expr.Attr
Hylograph.Expr.Datum
Hylograph.Expr.Expr
Hylograph.Expr.Friendly
Hylograph.Expr.Integration
Hylograph.Expr.Interpreter.CodeGen
Hylograph.Expr.Interpreter.Eval
Hylograph.Expr.Interpreter.Meta
Hylograph.Expr.Interpreter.PureSVG
Hylograph.Expr.Interpreter.SVG
Hylograph.Expr.Path
Hylograph.Expr.Path.Generators
Hylograph.Expr.Sugar
Hylograph.Expr.Units
Hylograph.HATS
Hylograph.HATS.Friendly
Hylograph.HATS.InterpreterTick
Hylograph.HATS.Transitions
Hylograph.Interaction.Brush
Hylograph.Interaction.Coordinated
Hylograph.Interaction.Pointer
Hylograph.Interaction.Zoom
Hylograph.Internal.Attribute
Hylograph.Internal.Behavior.FFI
Hylograph.Internal.Behavior.Types
Hylograph.Internal.Element.Operations
Hylograph.Internal.Element.Types
Hylograph.Internal.FFI
Hylograph.Internal.Transition.FFI
Hylograph.Internal.Transition.Manager
Hylograph.Internal.Transition.Scene
Hylograph.Internal.Transition.Types
Hylograph.Internal.Types
Hylograph.Interpreter.English
Hylograph.Interpreter.Mermaid
Hylograph.Interpreter.MetaHATS
Hylograph.Interpreter.SemiQuine
Hylograph.Interpreter.SemiQuine.TreeToCode
Hylograph.Interpreter.SemiQuine.Types
Hylograph.Scale
Hylograph.Scale.ColorSchemes
Hylograph.Scale.FP
Hylograph.Scale.Interpolation
Hylograph.Scale.Pure
Hylograph.Scale.Sequential
Hylograph.Shape.Arc
Hylograph.Shape.Pie
Hylograph.Shape.Polygon
Hylograph.Tooltip
Hylograph.Transform
Hylograph.Unified
Hylograph.Unified.Attribute
Hylograph.Unified.DataDSL
Hylograph.Unified.Display
Hylograph.Unified.Sugar