8/21/2018 Min, max, extent
- d3.min(data)
- d3.max(data)
- d3.extent(data)
JavaScript map array
| private void bounceAtEdge() | |
| { | |
| if (getX() == 0 || getX() == getWorld().getWidth()-1) { | |
| setLocation((double)getX(), (double)getY()); | |
| getMovement().revertHorizontal(); | |
| accelerate(0.9); | |
| // getImage() is part of the Actor class | |
| GreenfootImage currentImage = getImage(); | |
| // private method that returns a color | |
| Color randomColor = generateRandomColor(); |
| import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) | |
| import java.util.List; | |
| import java.util.ArrayList; | |
| /** | |
| * Write a description of class Dog here. | |
| * Dog was made for all the cute shiba inus in the world and to gain recognition for them. | |
| * @author (Caitlyn Oda) | |
| * @version (6/27/18) | |
| */ | |
| public class Dog extends Animal |
| <!DOCTYPE html> | |
| <meta charset="utf-8"> | |
| <svg id = "canvas" width="800" height = "400"></svg> | |
| <script src = "https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.2/d3.min.js"></script> | |
| <script> | |
| var data = [ | |
| {name: "panda", population: 2500}, | |
| {name: "tiger", population: 4000}, | |
| {name: "whooping crane", population: 400}, |
| <!DOCTYPE html> | |
| <meta charset="utf-8"> | |
| <svg id = "canvas" width="800" height = "450"></svg> | |
| <script src = "https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.2/d3.min.js"></script> | |
| <script> | |
| var data = [ | |
| {name: "panda", population: 2500}, | |
| {name: "tiger", population: 4000}, | |
| {name: "whooping crane", population: 400}, | |
| {name: "blue whale", population: 25000}, |
| <!DOCTYPE html> | |
| <meta charset="utf-8"> | |
| <svg id = "canvas" width="800" height = "450"></svg> | |
| <script src = "https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.2/d3.min.js"></script> | |
| <script> | |
| var data = [ | |
| {name: "panda", population: 2500}, | |
| {name: "tiger", population: 4000}, | |
| {name: "whooping crane", population: 400}, | |
| {name: "blue whale", population: 25000}, |
Create new HTML file with tag <body></body>
Download and save d3.js to your project.
https://raw.githubusercontent.com/alignedleft/d3-book/master/d3.js
In the HTML file, access the d3.js file using `