Skip to content

Instantly share code, notes, and snippets.

Created January 17, 2017 21:35
Show Gist options
  • Save anonymous/b62691ba4552e67684e491468df701e9 to your computer and use it in GitHub Desktop.
Save anonymous/b62691ba4552e67684e491468df701e9 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Jan 17, 2017.
    60 changes: 60 additions & 0 deletions examples-bar-graph.eve
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,60 @@
    # Pet Lengths

    Demonstration of the bar graph view.

    Create some pets with rigorously measured lengths.

    ```
    commit
    [#pet name: "koala" length: 7]
    [#pet name: "cat" length: 3]
    [#pet name: "whale" length: 12]
    [#pet name: "dog" length: 14]
    [#pet name: "orangutan" length: 9]
    [#pet name: "lemur" length: 5]
    ```

    Each pet is a single bar on our graph. The bar's label is the pet's name, it's height is the pet's length. The sort property tells the bar graph to draw the bar in alphabetical order based on the pets' names.

    ```
    search
    [#pet name length]
    ix = sort[value: name]

    bind @view
    [#bar-graph | bar: [label: name height: length sort: ix]]
    ```

    A team of scientists work tirelessly around the clock to keep the mysterious whargarbbl's length updated. Since each bar in the bar chart is bound above, the whargarbbl's bar will stay in sync.

    ```eve
    search
    [#time minutes seconds]
    length = random[seed: minutes * seconds] * 30

    bind
    [#pet name: "whargarbbl" length]

    ```

    ### Random stuff
    ```eve
    commit @browser
    [#div #txt text: "asd"]
    ```

    ```
    search
    [#time minutes seconds]

    search @browser
    x = random[seed: seconds]
    node = [#txt]

    commit @browser
    node.text := x
    // [#div text: x]
    ```