Search code examples
elm

SampleData elm package?


I'm trying to run the force directed graph from the elm visualisations examples.

However I can't identify what package the SampleData dependency is from.

...
import SampleData exposing (miserablesGraph)
...

Could I get a point in the right direction?


Solution

  • It seems to be something internal because examples on the Github have this data hardcoded.

    I'd suggest doing the same in your code. Either define miserablesGraph function:

    miserablesGraph : Graph String ()
    miserablesGraph =
        Graph.fromNodeLabelsAndEdgePairs
            [ "Myriel"
            , "Napoleon"
            , "Mlle.Baptistine"
    ...
    

    or create SampleData module and define the function there.

    module SampleData exposing (miserablesGraph)
    
    miserablesGraph : Graph String ()
    miserablesGraph =
        Graph.fromNodeLabelsAndEdgePairs
            [ "Myriel"
            , "Napoleon"
            , "Mlle.Baptistine"
    ...