我有一些来自http://dygraphs.com/的Dygraphs,它们最初呈现如下,x轴日期未正确呈现。
然后我通过缩小浏览器的大小来重新调整大小,然后重新调整大小,然后图形正确呈现如下
代码如下:
new Dygraph(document.getElementById("graphdiv_"+<?php echo $key; ?>),content_<?php echo $key; ?>, {
legend: 'always',
showRoller: false,
rollPeriod: 14,
customBars: true,
rightGap:15,
ylabel: 'Rating',
strokeWidth: 1.5,
digitsAfterDecimal: 3,
axes: {
y: {
valueRange: [3, 5]
}
}
});
这是一个错误吗?
我最初需要做出哪些调整才能正确渲染图表?
此致 康特
答案 0 :(得分:0)
以下解决了图形渲染的问题。
$(function() {
new Dygraph(document.getElementById("graphdiv_"+<?php echo $key; ?>),content_<?php echo $key; ?>, {
legend: 'always',
showRoller: false,
rollPeriod: 14,
customBars: true,
rightGap:15,
ylabel: '',
dateWindow: [new Date(date.getFullYear(), date.getMonth()-1, date.getDate()), new Date(date.getFullYear(), date.getMonth(), date.getDate())],
axes: {
y: {
valueRange: [3, 5]
}
}
});
});