一. 比例尺
此处记录常用的四种常用比例尺:线性、序数、序数段、时间比例尺,其它稍后更新或者自行官网查看
d3.scaleLinear()
d3.scaleOrdinal()
d3.scaleBand()
d3.scaleTime()
二. 坐标轴
api: axisBottom\Left\Right\Top等
使用:d3.axisBottom(scale); scale比例尺
三. vue使用
<template lang='pug'>
div.scale-pane(:id="id")
svg
</template>
<script>
/**
* 比例尺
*/
import * as d3 from 'd3'
export default {
name: 'Scale',
data() {
return {
id: ''
}
},
methods: {
uuid () {
function s4 () {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1)
}
return (
s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' +