Forum Discussion
alexisc67
8 years agoHelper I
D3 Custom Visual build a simple table doesn't display
Hi,
I need your help to find why the code below doesn't work. I am using the D3 custom visual with PowerBI Desktop. I have created a couple of sample charts with data and they work well. However I have not been able to display a simple table.
The data is loaded and has five columns. The custom visual is blank.
The code is below:
var margin = {top: 20, right: 30, bottom: 30, left: 40},
width = pbi.width - margin.left - margin.right,
height = pbi.height - margin.top - margin.bottom;
pbi.dsv(type, function(error, data) {
if (error) throw error;
var table = d3.select("#chart")
.append('table');
tbody = table.append("tbody");
var rows = tbody.selectAll("tr")
.data(data)
.enter()
.append("tr");
var cells = rows.selectAll("td")
.data(function(row) {
return d3.range(Object.keys(row).length).map(function(column, i) {
return row[Object.keys(row)[i]];
});
})
.enter()
.append("td")
.text(function(d) { return d; });
});
2 Replies
- alexisc67Helper I
HTML table is not supported. Only svg.
- v-chuncz-msftCommunity Support
Here is a forum dedicated to Custom Visuals Development. You could also send an email to [email protected].