在我调整浏览器大小之前,Dygraph 不会在 x 轴上显示所有日期
Dygraph not showing all dates on x axis until I adjust the browser size
我有一些来自 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]
}
}
});
这是一个错误吗?
我需要进行哪些调整才能使图形最初正确呈现?
问候
康特
以下解决了图形渲染的问题。
$(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]
}
}
});
});
我有一些来自 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]
}
}
});
这是一个错误吗?
我需要进行哪些调整才能使图形最初正确呈现?
问候 康特
以下解决了图形渲染的问题。
$(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]
}
}
});
});