Sometimes data needs to be converted from a continuous range, like test scores, to a discrete set of output values, like letter grades. In this lesson we’ll see how to use d3.scaleQuantize() to do exactly that.

function scaleQuantize(){
var quantizeScale = d3.scaleQuantize()
.domain([0, 100])
.range(["red", "white", "green"]); console.log(quantizeScale(22)); // red
console.log(quantizeScale(50)); // white
console.log(quantizeScale(88)); // green // Get the boundaries domain for "white" color
console.log(quantizeScale.invertExtent('white'));
}

最新文章

  1. c 语言的位运算符复习
  2. TFS2012 自动生成与部署
  3. kubernetes Ubuntu部署
  4. Angularjs,WebAPI 搭建一个简易权限管理系统 —— 系统业务与实现(三)
  5. 由fdopen和fopen想到的
  6. Ext.Net学习笔记24:在ASP.NET MVC中使用Ext.Net
  7. iOS 开发一年总结
  8. Java实现Linux下服务器程序的双守护进程
  9. log4jdbc
  10. Linux学习之chkconfig命令
  11. ASP.NET Core 1.0 部署 HTTPS
  12. Django 学习笔记(三)模板导入
  13. NOIP 2017 day -1 杂记
  14. #Java学习之路——第一部分总结
  15. Spring Data Jpa接口简介
  16. django.db.utils.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: ...
  17. 中间件 activeMQ Jms Java Demo
  18. div添加cursor:pointer;失效问题。
  19. 适配ipad Pro
  20. WordPress无插件实现SMTP给评论用户发送邮件提醒

热门文章

  1. windows下硬盘安装debian
  2. 28.semaphore跨进程通信
  3. 基于Linux系统的Nagios网络管理模块的实现
  4. Android 使用AIDL实现进程间的通信
  5. 基于面向对象js的弹窗的组件的开发案例
  6. python学习一,python基本语法
  7. centos7.2 64位安装java
  8. Beginning iOS Programming
  9. bitmap-setBounds方法参数研究
  10. actionbar-displayOptions 属性分析