d3.scale.linear() 与 d3.scaleLinear() [英] d3.scale.linear() vs d3.scaleLinear()

查看:39
本文介绍了d3.scale.linear() 与 d3.scaleLinear()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在查看 文档 以了解比例和它显示了这样的格式 var x = d3.scaleLinear([10,130]).range([0,960]) 我觉得这很奇怪,因为大多数 示例 使用的是这样的:

Hi I'm looking at the documentation for scales and it shows a format like this var x = d3.scaleLinear([10,130]).range([0,960]) I feel like this is strange because most examples that I see online use something like this:

var x = d3.scale.linear().domain([10,130]).range([0,960]) 并且它有效.

如果我使用 var x = d3.scaleLinear([10,130]).range([0,960]); 我得到一个类似

If I use var x = d3.scaleLinear([10,130]).range([0,960]); I get an error like

类型错误:d3.scaleLinear 不是函数

TypeError: d3.scaleLinear is not a function

为什么您认为文档中的示例与我在在线示例中看到的存在差异?也许我不明白如何阅读文档.

Why do you think there is a discrepancy between the examples in the documentation and what I see in examples online? maybe I don't understand how to read documentation.

这是当前的秤文档.

EDIT : This is the current documentation for scales.

推荐答案

您正在查看的文档是针对 D3 插件的——如何安装它在同一页面的下方进行了进一步描述.它最终将成为 D3 下一个主要版本的一部分.

The documentation you're looking at is for a plugin for D3 -- how to install it is described further down on that same page. It will eventually be part of the next major release of D3.

这篇关于d3.scale.linear() 与 d3.scaleLinear()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆