Mapping abstract values to visual representations is what data visualization is all about, and that’s exactly what D3 scales do. This is usually done using pretty straightforward algorithms, but nothing is straightforward when you’re working with Date objects in JavaScript. If you’re plotting temporal data, you need to use a time scale.

function scaleTime(){
var timeScale = d3.scaleTime()
.domain([new Date(2016,0,1), new Date()])
.range([0,100]); console.log(timeScale(new Date(2016,0,15)));
console.log(timeScale(new Date(2016,3,15)));
console.log(timeScale(new Date())); console.log(timeScale.invert(50));
}

最新文章

  1. android Json Gson FastJson 解析
  2. javascript 之 prototype继承机制
  3. sql-exists和not exists
  4. Can't find keyplane that supports type 4 for keyboard iPhone-Portrait-NumberPad; using 3876877096_Portrait_iPhone-Simple-Pad_Default
  5. tomcat如何按站点调试本机程序
  6. thinkphp 3+ 观后详解 (2)
  7. Oracle 11g AMM与ASMM切换
  8. Codeforces Round #333 (Div. 2) A. Two Bases 水题
  9. Constructor JavaScript构造器模式。
  10. Linux Mysql 总结
  11. Windows Azure Camp---漫步云端,创意无限
  12. android五种布局模式
  13. 内功心法 -- java.util.ArrayList<E> (1)
  14. 微软Visual Studio二十周年:VS2017于3月7日发布
  15. 《MySQL必知必会》读书笔记_2
  16. Redishelp
  17. Byte数组和字符串相互转换的问题
  18. HP-Socket v5.0.1:支持 IPv6 及多 SSL 证书
  19. python css盒子型 浮动
  20. [AIR] AIR程序调用本地默认应用程序打开本地文件

热门文章

  1. 华为PUSH SDK 接入方法
  2. UnrealEngine4针对游戏模式的思考
  3. ubuntu-文件管理、编辑
  4. Non-resolvable parent POM for **: Could not find artifact **
  5. slice深拷贝数组
  6. vue.js提交按钮时简单的if判断表达式示例
  7. 洛谷 P1893 山峰暸望
  8. golang iota
  9. es6常用功能与异步详解(JS高级面试题)
  10. Python 极简教程(十二)逻辑控制语句 if else