Comments (2)
Hi @smilefishes, yes! You can bring your own data in any format. The key is in providing the right "value" accessor:
var cartogram = d3.cartogram()
.value(function(feature) {
// return a value for each feature here
});
For instance, if you have your data in JSON as an object that maps feature IDs to numeric values, you could do this:
var data = {
AL: 20,
CA: 100,
FL: 50
// ...
};
cartogram.value(function(feature) {
return data[feature.id] || 0;
});
Feel free to re-open this issue with a more specific question if you still need help.
from topogram.
thanks a lot! It really works!
from topogram.
Related Issues (20)
- Cartogram of countries of the world display error HOT 16
- Does anyone know if this would enable nvd3 in IE8? HOT 1
- page starts out with no attribute selected HOT 1
- Comment Example Doesn't Have Correct Number of Variables HOT 6
- How can make d3-cartogram works on a NULL projection? HOT 1
- Area Scaling HOT 1
- Feature? Absolute scaling of cartogram regions HOT 3
- Uncaught TypeError: Cannot read property '0' of null HOT 1
- cartogram.js receive help to coordinate directly.
- topojson.merge topojson.mesh HOT 3
- Make this repo a d3-plugin
- Publish to npm HOT 2
- example is not working: pointing to wrong file HOT 1
- can't find build/topogram.js HOT 2
- Cartogram does not seem to load
- Needs modification to work with d3 v3 HOT 7
- debugger can not pause code
- sum() routine is wrong HOT 1
- Needs modification to work with topojson.v1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from topogram.