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.
# 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]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment