[D3] Load and Inspect Data with D3 v4
2016-12-12 21:12
369 查看
You probably use a framework or standalone library to load data into your apps, but what if that’s overkill for your needs? What if you’re just putting together a quick demo? This lesson demonstrates D3’s APIs for loading data on its own, as well as some helpful methods for inspecting your data and preparing it for use with D3.
function loadData() { d3.json('data/data.json', function(data) { var extent = d3.extent(data, function (d) { return d.age }); // get the value range console.log("#Extent", extent); var min = d3.min(data, function (d) { return d.age }); console.log("#Min", min); var max = d3.max(data, function (d) { return d.age }); console.log("#Max", max); var ages = d3.set(data, function(d) { return d.age }); // get unique value out of data console.log("#Ages", ages.values()); var scale = d3.scaleLinear() .domain(extent) .range([0,100]); console.log(scale(23)) }) }
相关文章推荐
- [D3] Start Visualizing Data Driven Documents with D3 v4
- Advanced Load Testing Scenarios with JMeter: Part 2 - Data-Driven Testing and Assertions
- [Nuxt] Load Data from APIs with Nuxt and Vuex
- WebView: loadData与loadDataWithBaseURL的区别
- Android应用开发之(WebView中loadData与loadDataWithBaseURL的使用上的区别)
- Problem Solving with algorithms and data structures using Python 翻译计划
- 基于Problem Solving with Algorithms and Data Structures using Python的学习记录(5)——Sorting
- Knockout is a JavaScript library that helps you to create rich, responsive display and editor user interfaces with a clean underlying data model.
- load data from (txt/ table and so on)
- Data analysis example with ggplot and dplyr (analyzing ‘supercar’ data, part 2)
- 100.In which situations does the Oracle Data Pump use external tables and not the direct path load w
- Apache/Tomcat with Failover and Load Balancing in 20 minutes or less…
- [D3] Convert Input Data to Output Values with Linear Scales in D3
- load data with matlab
- 创建 iOS 8 Today extension and share data with containing app – tutorial
- 运用模型绑定和web窗体显示和检索数据(Retrieving and displaying data with model binding and web forms)
- Load Balance Tomcat with Nginx and Store Sessions in Redis
- using Silverlight 4 in an ASP.NET MVC 3 application and accessing data with JSON
- Distributed transactions with multiple databases, Spring Boot, Spring Data JPA and Atomikos
- Along with all the above benefits, you cannot overlook the space efficiency and performance gains in using DataFrames and Dataset APIs for two reasons.