I have a bar chart with in dc.js. The x axis is dimension and y is the measure ranging from 1 - 10k. I want to show all the bars and their labels not overlapping each other. Chart looks fine when there are few bars when the number of bars starts to increase they look not okay. I am looking to auto resize the labels for the bar-chart.
I tried this method of renderlet to change the fontsize automatically
stackedBarChart.on('renderlet', function(chart) {
chart.selectAll('text.barLabel')
.attr('transform', function(d) {
//How do i get/set the width of the label here ?
});
group.all()
), and divide the chart width by that number to get the bar width. Then you could set the font size of the labels as some multiple of the bar width. This would work great in a pretransition hook. - GordonbarChart._barWidth
. Private members weren't exposed in earlier versions. - Gordon