Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to use d3js code to fetch the birt daset and disply a barchart using d3js code as below
JavaScript
<script type="text/javascript" src="http://d3js.org/d3.v2.min.js">
  <script type="text/javascript">
 // var dataset=[5,10,15,20,25];
var w = 500;
var h = 100;
var barPadding = 1;

var dataset=[<value-of>row["CUSTOMERNUMBER"]</value-of>];

//Create SVG element
var svg = d3.select("body")
.append("svg")
.attr("width", w)
.attr("height", h);
svg.selectAll("rect")
.data(dataset)
.enter()
.append("rect")
.attr("x", function(d, i) {
return i * (w / dataset.length);
})
.attr("y", function(d) {
return h - (d * 4);
})
.attr("width", w / dataset.length - barPadding)
.attr("height", function(d) {
return d * 4;
})
.attr("fill", function(d) {
return "rgb(0, 0, " + (d * 10) + ")";
});
svg.selectAll("text")
.data(dataset)
.enter()
.append("text")
.text(function(d) {
return d;
})
.attr("text-anchor", "middle")
.attr("x", function(d, i) {
return i * (w /dataset.length) + (w /dataset.length - barPadding) / 2;
})
.attr("y", function(d) {
return h - (d * 4) + 14;
})
.attr("font-family", "sans-serif")
.attr("font-size", "11px")
.attr("fill", "white");
	  </script>


But m not geting the complete dataset values,the code var dataset=[<value-of>row["CUSTOMERNUMBER"] giving only the last value in the column and not the complete column values
Posted
Updated 16-Oct-14 22:23pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900