Copyright | (c) Connor Moreside 2016 |
---|---|
License | BSD-3 |
Maintainer | connor@moresi.de |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Contains commonly used utility functions used throughout the library.
- omitNulls :: [(Text, Value)] -> Value
- createPayLoad :: Text -> Value -> Value
- createDataPayLoad :: Value -> Value
- addSessionId :: Text -> Text -> Text
- getLinks :: [[Double]] -> [[Double]]
- getNodes :: [[Double]] -> [Int]
- getPoints :: [Double] -> [Double] -> [[Double]]
- getPoints3 :: [Double] -> [Double] -> [Double] -> [[Double]]
- validateBin :: Maybe [Double] -> Either LightningError (Maybe [Double])
- validateColor :: Maybe [Int] -> Either LightningError (Maybe [Int])
- validateColorMap :: Maybe Text -> Either LightningError (Maybe Text)
- validateSize :: Maybe [Int] -> Either LightningError (Maybe [Int])
- validateAlpha :: Maybe [Double] -> Either LightningError (Maybe [Double])
- validateThickness :: Maybe [Int] -> Either LightningError (Maybe [Int])
- validateIndex :: Maybe [Int] -> Either LightningError (Maybe [Int])
- validateCoordinates :: [Double] -> [Double] -> Either LightningError ([Double], [Double])
- validateCoordinates3 :: [Double] -> [Double] -> [Double] -> Either LightningError ([Double], [Double], [Double])
- validateRegion :: [Text] -> Either LightningError [Text]
- validateConn :: [[Double]] -> Either LightningError [[Double]]
- defaultBaseURL :: Text
Utility Functions
:: [(Text, Value)] | The plot object to be serialized into JSON Value |
-> Value | The plot object with Nothing (null) fields removed. |
Used in conjunction with ToJSON. It will stop any field that is Nothing (null) in a record from being encoded in JSON.
:: Text | The name of the type of plot to create |
-> Value | The plot creation request record in JSON Value format |
-> Value | The properly encoded payload object |
Converts the plot creation request record into the proper JSON object that the lightning-viz server expects.
Creates a payload for streaming plots.
:: Text | The current URL |
-> Text | The session ID to add to current URL |
-> Text | Returns the URL with the session ID |
Appends the session route and session id to current URL.
Retrieves all the links for each of the nodes in the adjacency matrix.
Retrieves all of the nodes from an adjacency matrix.
Zips up x and y points into array pairs.
:: [Double] | X points |
-> [Double] | Y points |
-> [Double] | Z points |
-> [[Double]] | Returns [ [x, y, z] ] triplets |
Zips up x, y, and z points into array triples.
Validation Functions
validateBin :: Maybe [Double] -> Either LightningError (Maybe [Double]) Source #
Validates the bins of a histogram
validateColor :: Maybe [Int] -> Either LightningError (Maybe [Int]) Source #
Verify that the color specs are either in the form of [r, g, b] or a list of [[r,g,b],[r,g,b],...]
validateColorMap :: Maybe Text -> Either LightningError (Maybe Text) Source #
Verifiy that the color map specified is on of the colorbrewer maps.
Here are the available colorbrewer values: BrBG, PiYG, PRGn, PuOr, RdBu, RdGy, RdYlBu, RdYlGn, Spectral, Blues, BuGn, BuPu, GnBu, Greens, Greys, Oranges, OrRd, PuBu, PuBuGn, PuRd, Purples, RdPu, Reds, YlGn, YlGnBu, YlOrBr, YlOrRd, Accent, Dark2, Paired, Pastel1, Pastel2, Set1, Set2, Set3, or Lightning
validateSize :: Maybe [Int] -> Either LightningError (Maybe [Int]) Source #
Verify that all size values are greater than zero.
validateAlpha :: Maybe [Double] -> Either LightningError (Maybe [Double]) Source #
Verify all alpha values are greater than 0
validateThickness :: Maybe [Int] -> Either LightningError (Maybe [Int]) Source #
Verify all thickness values are greater than 0.
validateIndex :: Maybe [Int] -> Either LightningError (Maybe [Int]) Source #
Verify that there is at least one element in list.
Verify that the length of vector x is equal to length of vector y.
:: [Double] | x vector |
-> [Double] | y vector |
-> [Double] | z vector |
-> Either LightningError ([Double], [Double], [Double]) |
Verify that the lenths of the x, y, and z vectors are the same length.
validateRegion :: [Text] -> Either LightningError [Text] Source #
Verify that the lengths of the region names are either 2 letters or 3 letters.
2 letter region names must correspond to US states and 3 letter region names must correspond to countries of the world.
validateConn :: [[Double]] -> Either LightningError [[Double]] Source #
Verify that the multi-dimensional list adheres to expected dimensions.
defaultBaseURL :: Text Source #
Defines the default URL for the lightning-viz server.