我用 Dc.js 创建了一个行图。我有动态数据,所以我每次都有多种数据。现在,我的问题是我的行图的高度是静态的,并且 Svg 已压缩并且不清楚:
rowChart = dc.rowChart('#rowChart');
rowChart
.width(300)
.height(300)
.margins({ top: 20, left: 10, right: 10, bottom: 20 })
.group(barChartDimensionGroup)
.dimension(barChartDimension)
...
我有一个错误:
Error: Invalid negative value for attribute height="-4.894322420223788"
最佳答案
我通过@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)
...
关于javascript - Dc.js - 具有动态高度的行图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33141812/