Hossein Ganjyar
Hossein Ganjyar

Reputation: 192

Dc.js - Row Chart with dynamic height

I created a row chart by Dc.js. I've got dynamic data, So i've got multiple kind of data every time. Now, my problem is that my row chart's height is statica and Svg is Compressed and unclear:

rowChart = dc.rowChart('#rowChart');

rowChart 
 .width(300)
 .height(300)
 .margins({ top: 20, left: 10, right: 10, bottom: 20 })
 .group(barChartDimensionGroup)
 .dimension(barChartDimension)
 ...

And i've got a error:

Error: Invalid negative value for attribute height="-4.894322420223788"

Upvotes: 2

Views: 1301

Answers (1)

Hossein Ganjyar
Hossein Ganjyar

Reputation: 192

I found the solution through @gordon:

 rowChart = dc.rowChart('#rowChart');
 var heightRowChart=0;
 heightRowChart = rowChartDimensionGroup.all().length;

 tmpRowChart /* dc.rowChart('#day-of-week-chart', 'chartGroup') */
 .width(300)
 .height(heightRowChart*30)
 ...

Upvotes: 2

Related Questions