Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Graph “动态图”;x轴“;在两者之间_Graph_Intervals_Dygraphs - Fatal编程技术网

Graph “动态图”;x轴“;在两者之间

Graph “动态图”;x轴“;在两者之间,graph,intervals,dygraphs,Graph,Intervals,Dygraphs,我正在用动态图构建一个线性图。x轴上有“1234”,y轴上有“12,55,23,18”。当我绘制图表时,勾号在数字中间 例如,在1和2之间,我可以在x轴上看到1.5。我想要精确的间隔,我指定为1增量。有办法解决这个问题吗?如何在动态图中实现这一点?这是一个例子: <html> <head> <script type="text/javascript" src="dygraph-combined.js"></script> </he

我正在用动态图构建一个线性图。x轴上有“1234”,y轴上有“12,55,23,18”。当我绘制图表时,勾号在数字中间

例如,在1和2之间,我可以在x轴上看到1.5。我想要精确的间隔,我指定为1增量。有办法解决这个问题吗?如何在动态图中实现这一点?这是一个例子:

    <html>
<head>
<script type="text/javascript"
  src="dygraph-combined.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.
    ("Response Time,Loop\n" +
    "01,175\n" +
    "02,170\n" +
    "03,180\n" +
    "04,177\n" +
    "05,179\n"+
    "06,165\n")
  );
</script>
</body>
</html>

g=新动态图(
//包含div
document.getElementById(“graphdiv”),
//CSV或CSV文件的路径。
(“响应时间,循环\n”+
“01175\n”+
“02170\n”+
“03180\n”+
“04177\n”+
“05179\n”+
“06165\n”)
);

对此没有内置支持(您应该启动)。但您可以通过定义axisValueFormatter来模拟它,axisValueFormatter返回非整数的空字符串:

axes: {
    x: {
        axisLabelFormatter: function(num, gran, opts, g) {
            if (num == Math.floor(num)) {
                return Dygraph.numberAxisLabelFormatter(num, gran, opts, g);
            } else {
                return '';
            }
        }
    }
}
全功能演示