D3 Scale

https://blog.csdn.net/qq_34832846/article/details/90510150

1.Continuous Scales(连续型比例尺)

方法描述
d3.scaleLinear创建一个 continuous scale
continuous(value)根据domain(定义域)计算range(值域)
continuous.invert(value)根据定义域计算值域
continuous.domain([domain])设置值域
continuous.range([range])设置定义域
continuous.rangeRound([range])代替range,比例尺会四舍五入
continuous.clamp(clamp)设置边界,如果超出值域或者定义域,就去最大或最小的边界值
continuous.interpolate(interpolate)设置输出的差值算法
continuous.unknown([value])set the output value for unknown inputs.
continuous.tickscompute representative values from the domain.
continuous.tickFormatformat ticks for human consumption.
continuous.nice([count])extend the domain to nice round numbers.
continuous.copy()create a copy of this scale.
d3.scalePowcontinuous scale with the specified domain and range, the exponent 1
d3.scaleSqrtcontinuous power scale with the specified domain and range, the exponent 0.5
powcompute the range value corresponding to a given domain value.
pow.invertcompute the domain value corresponding to a given range value.
pow.exponentset the power exponent.
pow.domainset the input domain.
pow.rangeset the output range.
pow.rangeRoundset the output range and enable rounding.
pow.clampenable clamping to the domain or range.
pow.interpolateset the output interpolator.
pow.tickscompute representative values from the domain.
pow.tickFormatformat ticks for human consumption.
pow.niceextend the domain to nice round numbers.
pow.copycreate a copy of this scale.
d3.scaleLogcontinuous scale with the specified domain and range, the base 10
d3.scaleSymlogcontinuous scale with the specified domain and range, the constant 1
logcompute the range value corresponding to a given domain value.
log.invertcompute the domain value corresponding to a given range value.
log.baseset the logarithm base.
log.domainset the input domain.
log.rangeset the output range.
log.rangeRoundset the output range and enable rounding.
log.clampenable clamping to the domain or range.
log.interpolateset the output interpolator.
log.tickscompute representative values from the domain.
log.tickFormatformat ticks for human consumption.
log.niceextend the domain to nice round numbers.
log.copycreate a copy of this scale.
d3.scaleIdentitya special case of linear scales where the domain and range are identical
d3.scaleTimecreate a linear scale for time.
timecompute the range value corresponding to a given domain value.
time.invertcompute the domain value corresponding to a given range value.
time.domainset the input domain.
time.rangeset the output range.
time.rangeRoundset the output range and enable rounding.
time.clampenable clamping to the domain or range.
time.interpolateset the output interpolator.
time.tickscompute representative values from the domain.
time.tickFormatformat ticks for human consumption.
time.niceextend the domain to nice round times.
time.copycreate a copy of this scale.
d3.scaleUtccrete a linear scale for UTC.
d3.tickFormatformat ticks for human consumption.

2.Sequential Scales(序列比例尺)
与连续比例尺不同的是,序列比例尺的值域是根据指定的插值器内置且不可配置,并且它的插值方式也不可配置。序列比例尺也没有反转invert、值域range、值域求整rangeRound、插值器interpolate方法。

方法描述
d3.scaleSequentialcreate a sequential scale.
sequential.interpolatorset the scale’s output interpolator.
d3.scaleSequentialLog
d3.scaleSequentialPow
d3.scaleSequentialSqrt
d3.scaleSequentialSymlog
d3.scaleSequentialQuantile

3.Diverging Scales
发散比例尺的输出是根据插值器计算并且不可配置。同样没有反转invert、值域range、值域求整rangeRound、插值器interpolate方法。

方法描述
d3.scaleDivergingcreate a diverging scale.
diverging.interpolatorset the scale’s output interpolator.
d3.scaleDivergingLog
d3.scaleDivergingPow
d3.scaleDivergingSqrt
d3.scaleDivergingSymlog

4.Quantize Scales
量化比例尺类似于线性比例尺,其定义域也是连续的,但值域是离散的,连续的定义域值会被分割成均匀的片段。

方法描述
d3.scaleQuantizecreate a uniform quantizing linear scale.
quantizecompute the range value corresponding to a given domain value.
quantize.invertExtentcompute the domain values corresponding to a given range value.
quantize.domainset the input domain.
quantize.rangeset the output range.
quantize.niceextend the domain to nice round numbers.
quantize.tickscompute representative values from the domain.
quantize.tickFormatformat ticks for human consumption.
quantize.copycreate a copy of this scale.
d3.scaleQuantilecreate a quantile quantizing linear scale.
quantilecompute the range value corresponding to a given domain value.
quantile.invertExtentcompute the domain values corresponding to a given range value.
quantile.domainset the input domain.
quantile.rangeset the output range.
quantile.quantilesget the quantile thresholds.
quantile.copycreate a copy of this scale.
d3.scaleThresholdcreate an arbitrary quantizing linear scale.
thresholdcompute the range value corresponding to a given domain value.
threshold.invertExtentcompute the domain values corresponding to a given range value.
threshold.domainset the input domain.
threshold.rangeset the output range.
threshold.copycreate a copy of this scale.

5.Ordinal Scales(xus
序数比例尺的的定义域和值域都是离散的

分段比例尺类似于序数比例尺,区别在于分段比例尺的的定义域的值可以是连续的数值类型,而离散的值域则是将连续的定义域范围划分为均匀的分段。

方法描述
d3.scaleOrdinalcreate an ordinal scale.
ordinalcompute the range value corresponding to a given domain value.
ordinal.domainset the input domain.
ordinal.rangeset the output range.
ordinal.unknownset the output value for unknown inputs.
ordinal.copycreate a copy of this scale.
d3.scaleImplicita special unknown value for implicit domains.
d3.scaleBandcreate an ordinal band scale.
bandcompute the band start corresponding to a given domain value.
band.domainset the input domain.
band.rangeset the output range.
band.rangeRoundset the output range and enable rounding.
band.roundenable rounding.
band.paddingInnerset padding between bands.
band.paddingOuterset padding outside the first and last bands.
band.paddingset padding outside and between bands.
band.alignset band alignment, if there is extra space.
band.bandwidthget the width of each band.
band.stepget the distance between the starts of adjacent bands.
band.copycreate a copy of this scale.
d3.scalePointcreate an ordinal point scale.
pointcompute the point corresponding to a given domain value.
point.domainset the input domain.
point.rangeset the output range.
point.rangeRoundset the output range and enable rounding.
point.roundenable rounding.
point.paddingset padding outside the first and last point.
point.alignset point alignment, if there is extra space.
point.bandwidthreturns zero.
point.stepget the distance between the starts of adjacent points.
point.copycreate a copy of this scale.

参考:
https://blog.csdn.net/qq_34832846/article/details/90510150

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值