我正在设置这个条形图,我需要创建一个滚动窗口来查看整个数据集,主容器设置为500px,这设置为溢出滚动。,问题是当没有数据时,整个数据集图形容器正在将其高度更改为零,因为我根据点数动态调整容器的大小。
有没有一种简单的方法可以让容器在 highcharts.js 中保持 minHeigh: 500px ?
这是我的js:
chart: {
type: "bar",
backgroundColor: "#f2f2f2",
borderColor: "#fff",
borderWidth: 2,
borderRadius: 2,
spacing: [4, 40, 10, 3],
className: "main-graph",
height: 34 * (n_categories) + 69, //getting this value dynamically based on many items I have in chart, but if no data how to keep value to min-height:500px?
renderTo: 'mainChart',
plotBackgroundColor: null,
plotBorderWidth: null
},
我创建了一个jsfiddle
最佳答案
高度:((n_categories)?(34 * (n_categories) + 69):500),
关于javascript - 如果 highcharts.js 没有数据,图表容器的最小高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31529662/