html D3byEX 4.5:带风格的轴(适用于D3.js v4)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html D3byEX 4.5:带风格的轴(适用于D3.js v4)相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html>
<html>
<meta charset=utf-8>
<head>
<script src="http://d3js.org/d3.v4.min.js"></script>
<script src="https://d3js.org/d3-selection-multi.v1.min.js"></script>
<meta name="description" content="D3.js v4, .axisBottom, .scaleLinear,
axis bottom, selection multi" />
</head>
<body>
<script>
var data = [55, 44, 30, 23, 17, 14, 16, 25, 41, 61, 85, 101, 95, 105,
114, 150, 180, 210, 125, 100, 71, 75, 72, 67];
var maxValue = d3.max(data);
var width = 500, height = 500;
var svg = d3.select('body')
.append('svg')
.attrs({width: width, height: height}); // selection multi
var scale = d3.scaleLinear() // v4
.domain([0, maxValue])
.range([0, width]); // clipped
var axisGroup = svg.append('g');
var axis = d3.axisBottom() // v4
.scale(scale)
.tickSize(10)
.tickPadding(6);
var axisNodes = axisGroup.call(axis);
</script>
</body>
</html>
以上是关于html D3byEX 4.5:带风格的轴(适用于D3.js v4)的主要内容,如果未能解决你的问题,请参考以下文章
html D3byEX 5.9:带填充的范围带(适用于D3.js v4)
html D3byEX 4.8:左轴(适用于D3.js v4)
html D3byEX 4.6:顶轴(适用于D3.js v4)
html D3byEX 4.4:底轴(适用于D3.js v4)
html D3byEX 9.10:符号(适用于D3.js v4)
html D3byEX 7.4:链式转换(适用于D3.js v4)