gpt4 book ai didi

javascript - Vis.js双y轴数据范围问题

转载 作者:行者123 更新时间:2023-11-27 22:32:15 25 4
gpt4 key购买 nike

<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>

<link href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.15.1/vis.min.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.15.1/vis.min.js"></script>

<body>
<h2>Graph2d | Basic Example</h2>
<br />
<div id="visualization"></div>
<script type="text/javascript">
var container = document.getElementById('visualization');
var names = ['graph1', 'graph2'];
var groups = new vis.DataSet();
groups.add({
id: 0,
className: '',
options: {
yAxisOrientation: 'left',
drawPoints: {
style: 'point' // square, circle
}
}});
groups.add({
id: 1,
className: '',
options: {
yAxisOrientation: 'right', // right, left
drawPoints: {
style: 'circle' // square, circle
}
}});

var items = [
{x: new Date(1469626499397), y: 110, group: 0},
{x: new Date(1469626499497), y: 125, group: 0},
{x: new Date(1469626499597), y: 130, group: 0},
{x: new Date(1469626499697), y: 210, group: 0},
{x: new Date(1469626499897), y: 115, group: 0},
{x: new Date(1469626499997), y: 130, group: 0},
{x: new Date(1469626499397), y: 1, group: 1},
{x: new Date(1469626499597), y: 2, group: 1},
{x: new Date(1469626499697), y: 3, group: 1},
{x: new Date(1469626499797), y: 10, group: 1},
{x: new Date(1469626499897), y: 15, group: 1},
{x: new Date(1469626499997), y: 10, group: 1}
];

var dataset = new vis.DataSet(items);
var options = {
height:500,
//graphHeight:1500,
drawPoints: true,
dataAxis: {
right: {
range: {min:-1, max:20}
},
left: {
range: {min:100, max:250}
},
icons:true
},
};
var graph2d = new vis.Graph2d(container, dataset, groups, options);
</script>
</body>
</html>

/image/5Ug11.png在图像中,右侧 y 轴未显示小于 5 和大于 12 的网格线。

我在这里面临的问题是右侧 y 轴未正确获取数据范围并隐藏图表,即使右侧数据范围从最小值 1 和最大值 15 开始。

抱歉我的英语不好。

最佳答案

似乎这个问题出现在 vis.js 版本 4.13.0 及以上版本中。双 y 轴在 4.12.0 版本发布中按预期工作。

关于javascript - Vis.js双y轴数据范围问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39464572/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com