需要展现的JSON:
{"users":[
{"name":"jane","value":2};
{"name":"miko","value":1};
{"name":"jack","value":4};
]}
代码:
<pre name="code" class="html"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>D3 Test</title>
<style>
.chart rect {
fill: steelblue;
}
.chart text {
fill: white;
font: 10px sans-serif;
text-anchor: end;
}
.axis text {
font: 10px sans-serif;
fill: black;
}
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
</style>
</head>
<body>
<svg class="chart"></svg>
<script src="http://d3js.org/d3.v3.min.js" charset="ut