Last active
February 16, 2018 07:52
-
-
Save curran/c1ce02fec883faa15fe2191d98985440 to your computer and use it in GitHub Desktop.
Visual List Library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit | |
height: 800 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
[ | |
{ "name": "Milk", "price": 3 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 20 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 }, | |
{ "name": "Cupcakes", "price": 5 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 }, | |
{ "name": "Apples", "price": 4 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 }, | |
{ "name": "Apples", "price": 4 }, | |
{ "name": "Bread", "price": 4 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 }, | |
{ "name": "Apples", "price": 4 }, | |
{ "name": "Bread", "price": 4 }, | |
{ "name": "Cookies", "price": 6 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 }, | |
{ "name": "Apples", "price": 4 }, | |
{ "name": "Bread", "price": 4 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 }, | |
{ "name": "Apples", "price": 4 }, | |
{ "name": "Bread", "price": 4 }, | |
{ "name": "Bananas", "price": 1 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 }, | |
{ "name": "Apples", "price": 4 }, | |
{ "name": "Bread", "price": 4 }, | |
{ "name": "Bananas", "price": 1 }, | |
{ "name": "Onions", "price": 2 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 }, | |
{ "name": "Apples", "price": 4 }, | |
{ "name": "Bread", "price": 4 }, | |
{ "name": "Bananas", "price": 1 }, | |
{ "name": "Onions", "price": 2 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 }, | |
{ "name": "Apples", "price": 4 }, | |
{ "name": "Bread", "price": 4 }, | |
{ "name": "Bananas", "price": 1 }, | |
{ "name": "Onions", "price": 2 }, | |
{ "name": "Garlic", "price": 1 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 }, | |
{ "name": "Apples", "price": 4 }, | |
{ "name": "Bread", "price": 4 }, | |
{ "name": "Bananas", "price": 1 }, | |
{ "name": "Onions", "price": 2 }, | |
{ "name": "Garlic", "price": 1 }, | |
{ "name": "Smoked Salmon", "price": 14.75 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 }, | |
{ "name": "Apples", "price": 4 }, | |
{ "name": "Bread", "price": 4 }, | |
{ "name": "Bananas", "price": 1 }, | |
{ "name": "Onions", "price": 2 }, | |
{ "name": "Garlic", "price": 1 }, | |
{ "name": "Smoked Salmon", "price": 14.75 }, | |
{ "name": "Broccoli", "price": 3.65 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 }, | |
{ "name": "Apples", "price": 4 }, | |
{ "name": "Bread", "price": 4 }, | |
{ "name": "Bananas", "price": 1 }, | |
{ "name": "Onions", "price": 2 }, | |
{ "name": "Garlic", "price": 1 }, | |
{ "name": "Smoked Salmon", "price": 14.75 }, | |
{ "name": "Broccoli", "price": 3.65 }, | |
{ "name": "Coffee", "price": 5.99 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 }, | |
{ "name": "Apples", "price": 4 }, | |
{ "name": "Bread", "price": 4 }, | |
{ "name": "Bananas", "price": 1 }, | |
{ "name": "Onions", "price": 2 }, | |
{ "name": "Garlic", "price": 1 }, | |
{ "name": "Smoked Salmon", "price": 14.75 }, | |
{ "name": "Broccoli", "price": 3.65 }, | |
{ "name": "Coffee", "price": 5.99 }, | |
{ "name": "Sugar", "price": 9.98 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 }, | |
{ "name": "Apples", "price": 4 }, | |
{ "name": "Bread", "price": 4 }, | |
{ "name": "Bananas", "price": 1 }, | |
{ "name": "Onions", "price": 2 }, | |
{ "name": "Garlic", "price": 1 }, | |
{ "name": "Smoked Salmon", "price": 14.75 }, | |
{ "name": "Broccoli", "price": 3.65 }, | |
{ "name": "Coffee", "price": 5.99 }, | |
{ "name": "Sugar", "price": 9.98 }, | |
{ "name": "Mozzarella Cheese", "price": 4 } | |
], | |
[ | |
{ "name": "Milk", "price": 3 }, | |
{ "name": "Eggs", "price": 2 }, | |
{ "name": "Apples", "price": 4 }, | |
{ "name": "Bread", "price": 4 }, | |
{ "name": "Bananas", "price": 1 }, | |
{ "name": "Onions", "price": 2 }, | |
{ "name": "Garlic", "price": 1 }, | |
{ "name": "Smoked Salmon", "price": 14.75 }, | |
{ "name": "Broccoli", "price": 3.65 }, | |
{ "name": "Coffee", "price": 5.99 }, | |
{ "name": "Sugar", "price": 9.98 }, | |
{ "name": "Mozzarella Cheese", "price": 4 }, | |
{ "name": "Tomatoes", "price": 3 } | |
] | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Shopping App Prototype</title> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script src="visualList.js"></script> | |
</head> | |
<body> | |
<svg width="960" height="500"></svg> | |
<script> | |
d3.json('data.json', data => { | |
data.forEach((list, i) => { | |
setTimeout(() => { | |
d3.select('svg').call(visualList, { | |
data: list, | |
xValue: d => d.price, | |
margin: { | |
left: 220, | |
right: 220, | |
top: 20, | |
bottom: 20 | |
}, | |
barPadding: 0.1, | |
yValue: d => d.name, | |
verticalSpacing: 60, | |
transitionDuration: 800, | |
textValue: d => `${d.name} $${d.price}` | |
}); | |
}, i * 1000); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
�PNG | |