【发布时间】:2015-04-13 21:36:11
【问题描述】:
我最近开始使用 Dygraphs, 我发现如果数据只有一条记录, 图表下方的 x 轴上没有标签显示。
例如,使用来自tutorial of Dygraphs site 的代码:
<html>
<head>
<script type="text/javascript"
src="dygraph-combined-dev.js"></script>
</head>
<body>
<div id="graphdiv"></div>
<script type="text/javascript">
g = new Dygraph(
// containing div
document.getElementById("graphdiv"),
// CSV or path to a CSV file.
"Date,Temperature\n" +
"2008-05-07,75\n" +
"2008-05-08,70\n" +
"2008-05-09,80\n"
);
</script>
</body>
</html>
我将数据改为一条记录:
// CSV or path to a CSV file.
"Date,Temperature\n" +
"2008-05-07,75\n"
x 轴上不显示任何标签。
我尝试查看 Dygraphs 的选项参考, 但是当数据只有一条记录时,似乎没有选项可以绘制标签。
知道在只输入一条记录时如何绘制标签吗?
【问题讨论】:
标签: javascript dygraphs