[英]how to restrict the Y- axis and X-axis values in vis.js
I am trying to draw a graph its all working good but i am getting this issue the Y-axis has occupied majority of my graph area and moreover the x-axis values start from some where how to get those values from where the graph begins how can i achieve this here is my html file 我正在尝试绘制所有正常工作的图形,但我遇到了这个问题,Y轴占据了我的大部分图形区域,而且X轴的值从某个位置开始,如何从图的开始处获取这些值。我可以在这里实现这个是我的html文件吗
PS the black line is line drawn in pinta of ubuntu it has nothing to do with the graph. PS黑线是在ubuntu的pinta中绘制的线,与图形无关。
<!DOCTYPE HTML>
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>Graph2d | Basic Example</title>
<style type="text/css">
body, html {
font-family: sans-serif;
}
</style>
<script src="../../dist/vis.js"></script>
<link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-61231638-1', 'auto');ga('send', 'pageview');</script></head>
<body>
<div id="visualization"></div>
<script type="text/javascript">
var a=['10','20','30'];
var container = document.getElementById('visualization');
var str= [{"y":0.5344999999999999,"x":"2016-01-07 03:00:06.525036"},{"y":0.4541666666666668,"x":"2016-01-07 04:45:55.669235"},{"y":0.5185000000000001,"x":"2016-01-07 06:08:02.645683"}];
console.log(typeof(str));
var dataset = new vis.DataSet(str);
var options = {
start: '2015-06-10',
end: '2014-06-18'
};
var graph2d = new vis.Graph2d(container, dataset, options);
</script>
</body>
</html>
Looks like the main issue here is some round-off errors popping up in the vertical axis (like 0.44999999999999996
instead of 0.55
). 看起来这里的主要问题是在垂直轴上弹出了一些舍入错误(例如
0.44999999999999996
而不是0.55
)。 You can open an issue for that in the issues section of the project: https://github.com/almende/vis/issues 您可以在项目的问题部分为此打开一个问题: https : //github.com/almende/vis/issues
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.